Get a Demo

 

The Meta API integration platform-as-a-service (iPaaS) empowers your developers, data analysts, and IT admin to connect applications and data quickly. 

3 min read

Simplify your inventory management with Flotiq & Meta API

In this case study, we will show you how automation can simplify a daily task, by creating automatically a report in Google Spreadsheet based on the amount of product inventory using the Flotiq API on our platform.

Step by step, you will see how to add an API on the platform, how to create a Spell by choosing the right connectors, and how to set up your code to retrieve the data you want.

 

What is Flotiq?

Flotiq is an API-first content management platform that works with any technology, framework, and language. In Flotiq, we decided to solve common content workflow problems by creating a tool that makes collaboration easier. Bridging the worlds of developers and content managers together, we help them work more efficiently and reach that common flow that just gets things done.

flotiq website

 

Track your inventory in real time

This guide shows how to add your private Flotiq API to Meta-API and prepare an example Spell. In our case we will create a report in Google Spreadsheet based on products stock quantity.

Track your inventory in real time

 

1. Create an empty sheet in Google Spreadsheets

Let's prepare our spreadsheet to use in further steps. We add two columns (Date, Stock Quantity) and a chart with the default config for these columns.

Google Spreadshit

Notice the spreadsheet id. It's located in the URL https://docs.google.com/spreadsheets/d/[___here___]/edit#gid=0. We will use it in the next steps.

 

2. Model your data in Flotiq

Sign in to your Flotiq account and make sure that you have added your Content Type Definitions. In our example, we use predefined Product CTD with an extra property named stock_quantity.

Flotiq stock

Now it's time to add some example data. As we are creative, we added more sophisticated data than "Lorem ipsum" :)

Flotiq objects of type produc

 

3. Get your OpenAPI Specification

This is a crucial step in Flotiq. Let's open your API Doc and download OpenAPI Specification.

 

Flotiq API

 

Flotiq OpenAPI

We use the content of the downloaded file in the next step.

 

4. Add your Flotiq API to Meta-API

 

Why there is no predefined Flotiq API in Meta-API catalog?
The Main concept of Flotiq is that your API Specification represents your set of content definitions literally. Your API represents your endpoints, with your models consisting of your properties. In short, Flotiq API contains different endpoints for each user to be more personalized.

 

We assume that you have an account on Meta-API platform and you are logged in. Go to the Catalog of API and click "Add an API".

Meta API platform

In the Add an API to the catalog modal, go to the bottom and fill the Open API Specification field with data retrieved in step 2. Other fields (except Category) should auto-complete.

Meta API add API

And that's it. We have our private Flotiq API in our private Meta-API Catalog. Now we can use it to create a Spell.

 

5. Create a Spell that connects Flotiq with any other API


When our API is added to Catalog, we can add a data flow between Flotiq and other applications. Go to the Spells section in Meta-API dashboard and click Create a new Spell.

Meta API Spells

In the Choose the API step, find your Flotiq API.

Meta API choose the API

Next, choose Connector, which means the configurable endpoint you want to call. Select a products list endpoint (GET /api/v1/content/product). Click Use.

Meta API Choose Connectors

Now it is time to connect Flotiq with other applications.

In our example we choose Google Spreadsheet API, and append Connector (which match POST /v4/spreadsheets/{spreadsheetId}/values/{range}:append endpoint).

A "Google Spreadsheet Append" connector is responsible for appending the values to a selected spreadsheet.

Meta API select connectors

 

Meta API choose connector

Next, click "Continue with 2 connectors" and go through the following steps with values to create your Spell.

Meta API connectors google spreadshit

Now you should see the edit Spell view.

Meta API Spell code

 

6. Authenticate your Connectors

As you can see in the right sidebar, there are a few alerts. To update our configuration, click the "Fix" button next to Flotiq User API.

Meta API authentication

In the settings panel for Flotiq User API, click "Configure Authentication", and paste here your API Key from Flotiq.

Note: If you are new to Flotiq, check how to obtain your Flotiq API Key

Flotiq User API

Approve your settings and go back to the errors list clicking "x" in the sidebar.

MetaAPI code editor

The next step is to authenticate the Google Spreadsheet connector. Click "Fix" next to "Google Spreadsheet".

Meta API spell activity

This configuration is slightly different from Flotiq because it uses oAuth2.0. Use the "One-click Auth with Meta Api" wizard to authenticate.

Meta API Code editor one click

There are also a few properties that should be updated in Google Spreadsheet Connector settings.

Please set: - spreadsheetId value to spreadsheet id obtained in the first step, - valueInputOption to USER_ENTERED, - range to A2.

Meta API parameters

We are almost ready!

 

7. Add code to process data

In the previous steps, we were focused on the sidebar in the spell configuration view. Now let's move to the section with code.

It is up to you what transformations you will create here. In our case, we will sum up all product storage quantities and place them next to the current date.

So, update the code - add this snippet below //#endregion End of Flotiq User API connector:

const dataRow = [
(new Date()).toLocaleString(), // date
flotiqUserApiResult.data.reduce((sum, prod) => (sum + prod.stock_quantity), 0) // quantity
];

And in the Google Spreadsheet connector code replace null with our dataRow:

values: [
dataRow
]

MEta API code editor

That's it! It's so simple to code your custom transformations. Ready to test?

 

8. Test the flow

Click the "Run" button on the right-bottom to test our Spell.

Meta API run

Run succeeded. You can browse execution logs in the dashboard, but more exciting is our spreadsheet. Meanwhile, we made a few extra "Runs" and changed product quantities in the Flotiq dashboard.

Google spreadshit result

 

Next steps

As you can see, there are almost endless possibilities to use Flotiq and Meta-API integration.

We suggest you play with Flotiq and Meta-API:

Reddit & Discord integration

If you’re a subreddit owner and a Discord server owner, you may want to keep your Discord channel in sync with your subreddit.

Meta API

One step towards the revolution of APIs usage

Hey there 👋,

I hope you are doing well in these complicated times.

I’ll try to cheer you up and, maybe, inspire you with this project which is the...

Top 50 most used APIs in Meta API

An API, or application programming interface, is a set of definitions and protocols that facilitate the creation and integration of software...