BlogUse Cases

How to Make an API Call With Integromat [Tutorial]

One of the most underrated aspects about Integromat lies within the “Make an API call” module many of our apps feature. 

In simple terms, this module is a door to API functions that are not available as standalone Integromat app modules. 

Where do these functions come from? Easy: they are featured in the original APIs that power Integromat apps. 

Take the Integromat Shopify app, for example. 

Among the modules available for this app, there is one to “Get an order”. But what if you need to get all orders at once? 

Here’s where the “Make an API call” module comes in handy, because:

  • There isn’t a specific Integromat module to get all orders
  • This function is supported by the original Shopify API

So, if you are using Integromat to automate Shopify and need to get all the orders from a specific period, you can use the “Make an API call” module to do it.  

In other words, this module provides you with all the API functions you need, even if these are not available as Integromat modules. 

Pretty neat, huh? 

In this article, we will show you how to use the “Make an API call” module. However, before diving into the details, let’s go over the basics to understand how APIs work.

What is an API?

An Application Programming Interface (API) is a piece of intermediary software that defines interactions between applications. 

Simply put, APIs are a set of rules and functions that determine access to app features and data.

The functions are commonly referred to as “endpoints”. An endpoint is a URL that when an HTTP request is made, it will instruct the app to take a particular action.

On the other hand, rules are set to establish limits on what users can do with those endpoints. 

Let’s illustrate with a real-life example: Twitter. 

As with many other apps, Twitter offers a public API featuring plenty of useful endpoints, which in turn are bound by specific rules. 

One of the available endpoints allows you to automatically look up tweets. 

There is also a rule to limit the use of this endpoint. It establishes that you can look up to 900 tweets every 15 minutes using the Twitter API. 

Generally speaking, this is what you can expect from APIs: specific functions, bound by rules, to automate actions, processes, and tasks.

This is why APIs are key elements of automation and the “API economy”. 

By removing complexity and providing a framework so apps can “talk” to each other, they set the basis for the kind of automation Integromat allows for. 

Get full access to the most popular APIs with Integromat

The rules and functions featured by APIs are laid out in documentation, which is often (but not always) available on company sites. 

For example, the Shopify API is documented in detail at: https://shopify.dev/docs/admin-api

shopify-api-documentation-gif-alt

 

Going through these docs you will notice that an API consists of a range of different endpoints for specific actions. 

For example, here is a Shopify API endpoint which can be used to retrieve all the orders of a particular shop on Shopify.

shopify-api-list-of-orders-endpoint-alt

The endpoints that the APIs of these apps offer are housed inside the Integromat platform as app modules.

shopify-integromat-app-modules-gif-alt


Behind the scenes, these app modules communicate with the Shopify API and make requests based on the task that has to be performed. 

For example, the “Watch orders” module in the list above makes a request to the Shopify API endpoint, which in turn sends back a list of orders from the Shopify store.

shopify-integromat-watch-orders-module.png

This is how Integromat works behind the scenes: by simplifying the access and use of thousands of endpoints. 

How to use the 'Make an API call' module

As we shared above, the “Make an API” call is a door to API endpoints that aren’t featured as Integromat modules. 

This module is vital for one reason: it allows you to access new endpoints as they get released by the apps who own the APIs. 

As a result, you don’t have to wait until the Integromat team creates new modules for new API endpoints. 

If you need to use a newly released API endpoint right away, the “Make an API call” module will do the trick until the corresponding endpoint is officially launched. 

At the moment this module is available in the most popular apps like Shopify, Airtable, Google Sheets,  Twitter, and Slack. 

Since these are the apps that get updated the most, having the “Make an API call” guarantees you full API access via Integromat.
 metafields-and-records-screenshot-alt


The sole purpose of this module is to provide you with the possibility to make requests to an API. 

To make it work, you need to manually enter the following data into the module’s fields:

  • API endpoint (i.e. the URL)
  • API version
  • Query string

And all the other necessary parameters to make a successful call to the API.

integromat-shopify-make-an-api-call-alt


Obviously, you don’t need to know beforehand what to enter in these fields. This is where API documentation kicks in.

Referencing the API documentation

As seen earlier with the Shopify API example, the documentation provides a clear set of rules that you need to follow in order to make an API call. 

Now, let’s see how to set up the “Make an API call” module for a Shopify API endpoint that is not available as an Integromat module. 

The endpoint we are gonna call allows you to get a list of orders from your Shopify store.

shopify-api-list-of-orders-endpoint-1-alt


For example, with the information available on the endpoint above, we fill the fields the 'Make an API call' module like this:

  • URL: orders.json 
  • Request method type: GET
  • Query string will consist of one item with: key = status / value = any


setting-up-shopify-api-call-integromat-module-alt


Once all the fields are filled, you will need to click “OK”. 

After doing this, you can add a Google Sheets module, execute the Integromat scenario, and send all your Shopify orders to a spreadsheet. 

Now, let’s move on and see the module in action with two practical examples. 

1. Making an API call to retrieve a count of products on Shopify

In this example we are going to use the “Make an API call” module to retrieve a count of products. Naturally, there is an available Shopify API endpoint to perform this action: 

shopify-api-list-of-endpoints-alt

First we will enter the data that the documentation provides in the 'Make an API call' module.

setting-up-make-an-api-call-module-shopify-alt

Let's take it step by step.

The first step is to define the URL of the request. In this case, it is important that you take in consideration the hint below the field. 

You only need to provide the path relative to the full URL of the endpoint, which means you only need to enter products/count.json

shopify-api-product-count-endpoint-alt

So, in the “Make an API call” module, you will have enter this data into the corresponding field.

make-an-api-call-module-shopify-endpoint-2-alt


Next, you need to enter the version of the API you would like to make a request to. 

The API version in this case is clearly shown on the endpoint URL.

shopify-api-version-alt

Again, fill in the field in the Integromat module, like this:

discord-api-version-integromat-alt

Finally, you will need to select the API request method. In this case it will be a GET request, since this is what the API endpoint allows for. 

shopify-api-count-endpoin-method-alt

Don’t forget to set the API request method to “GET” on the Integromat module:

make-an-api-call-module-method-1-alt


And just like that, the module is now fully set up to make an API request to the endpoint.

setting-up-shopify-api-call-integromat-module-1-alt


Let's execute the scenario to see the results.


shopify-api-call-automation-alt


As you can see the module was successfully executed. 

The API call was performed, retrieving the total number of products on the Shopify store (that was just two products). 

2. Making an API call to get Discord channel information

Let's take a look at another example with another popular app: Discord. 

Integromat features many Discord modules, but none for getting a channel’s information. 

integromat-discord-modules-gif-alt


However, this action is available as an endpoint on the Discord API. The endpoint is called “Get Channel”, and can be found within the Discord API documentation.

discord-api-get-channel-alt


Now, let's configure an API call to this endpoint.

The URL field will once again be relative to https://discordapp.com/api.

discord-api-get-channel-url-alt


Therefore, we only need to include the endpoint section of the URL which is /channels/{channel.id}

The channel ID on Discord can be obtained by opening the channel and copying the second number from the URL.

On the “Make an API call” module, it will look like this:


integromat-discord-make-an-api-call-url-alt


As you can see, not every API is the same. 

The Discord API does not require us to provide an API version like the Shopify one. 

Also, some APIs will also require you to enter more data. All this information will be available on the API documentation pages. As long as you look at the endpoint in there, you will be able to pick it up from there. 

To conclude setting up the “Make an API call” module, set the “Method” field to “GET”, and click “OK”.

  

make-an-api-call-module-method-s-alt


Now that the module is fully set up, let's go ahead and execute it!


discord-automation-api-call-alt

As you can see it has been successfully executed. 

After making the request to the Discord “Get Channel API” endpoint, Integromat retrieves the information for that specific Discord channel. 

Conclusion

Hopefully, you can now take advantage of the “Make an API call” module, and achieve more with your apps.

Just keep this in mind at all times when thinking about the possibilities this module offers:

  • Full access to APIs is a key functionality not every automation platform provides
  • Companies that offer APIs want you to automate and make the most of them
  • The “Make an API call” module makes it possible to easily perform a request to any API endpoint
  • Documentation is the main reference point you will need to fill out the fields in the Integromat module

    Happy automating!

Do you like this article?
Don't forget to share it!
Share

Get started now!

Sign up for a free Integromat account today!