How to Make an API Call With Make [Tutorial]

Mar 10, 2021 | 7 minutes
How to Make an API Call With Make

One of the most underrated aspects about Make 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 Make app modules. 

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

Take the Make 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 Make module to get all orders

  • This function is supported by the original Shopify API

So, if you are using Make 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 Make 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 Make allows for. 

Get full access to the most popular APIs with Make

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

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 endpoint

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

shopify-api-make-modules

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.

Watch orders module

This is how Make 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 Make 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 Make 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 Make. 

Make an API call

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.

Make gif 01 Once

discord-api-make-modules

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 Make module. 

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

endpoint

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

Make an API call Shopify

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

After doing this, you can add a Google Sheets module, execute the Make 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: 

available Shopify API endpoint

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

enter the data

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

products count json

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

Url path

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.

API version

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

Api version

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. 

GET request

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

Method Get

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

module is set up to make an API request

Let's execute the scenario to see the results.

shopify-api-call-make-scenario

As you can see the module was successfully executed. 

shopify-api-call-make-scenario-success

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. 

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

discord-api-make-modules

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.

Get Channel endpoint

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

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

include the endpoint section of the URL

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:

channel ID on Discord

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”.

call module method

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

discord automation api call

As you can see it has been successfully executed. 

After making the request to the Discord “Get Channel API” endpoint, Make 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 Make module

    Happy automating!

Dimitris Profile

Dimitris Kamaritis

Solutions Architect at Make. I’m passionate about helping businesses and entrepreneurs build digital solutions and automating their workflows!

Like this use case? Spread the word.

Get monthly automation inspiration

Join 75,000+ Makers and get the freshest content delivered straight to your inbox.