How to Perform API Calls in Make No-Code Automation: A Step-by-Step Guide with Spoonacular API

As the weekend approaches, many of us start thinking about cooking up something special or perhaps browsing through recipes to try something new. But did you know that you can automate your recipe search and meal planning using APIs? 

In this blog, we’ll explore how to perform API calls in Make (formerly known as Integromat) and use the Spoonacular API to make your weekend cooking even more exciting. 

What is an API?

API stands for Application Programming Interface. Simply put, an API is a way for different software applications to talk to each other. 

They provide a set of URLs that you can send data to in order to modify settings, add data, or retrieve information from the software. 

Imagine you're at a restaurant, and the menu (API) is what allows you to order (send data) and receive your food (get data) from the kitchen (software). 

This functionality is very useful for developers who need to connect different systems or enhance the capabilities of an existing application. 

With APIs, the possibilities for automation and integration are endless.

Why Learn API Integration with Make?

Make offers a number of predefined modules for popular apps such as Google Sheets, Gmail, Shopify, and more. 

These modules make it easy to connect different apps and automate tasks. However, there may be times where a specific app is not available within Make’s modules. This is where APIs come into play. 

For instance, if you want to use an app like Spoonacular, which generates meal plans and recipes, but is not available on Make, you can still integrate it using API through Make’s HTTP request module. 

With this, you can connect to any app that offers an API. By understanding how to use this module, you can expand the capabilities of Make beyond its standard offerings. 

Understanding HTTP Requests

HTTP requests are the backbone of API calls. There are different types of requests you can make, but the most common ones you’ll encounter are:

     GET: Retrieve data from a server.

     POST: Send data to a server to create or update resources.

     PUT: Update existing resources with new data.

     PATCH: Update parts of a resource.

     DELETE: Remove resources from a server.

In Make, the HTTP request module allows you to choose the method (GET, POST, etc.), enter the URL of the API, and specify any data or parameters that need to be sent. 

Example: Integrating Spoonacular API with Make

Let’s look at a practical example using the Spoonacular API, which is perfect for the weekend ahead. 

Imagine you want to search for recipes, generate a meal plan, or find ingredient substitutes—all through automation. Here’s how you can do it:

Step 1: Setting Up Authentication

To access the Spoonacular API, you’ll need an API key, which is like a password that lets the API know who you are. After signing up for a free account, you'll receive an API key. 

In Make, you can add this key to your HTTP request module under the header section to authenticate your API calls.

Step 2: Searching for Recipes

Let’s say you want to search for a recipe using the Spoonacular API. 

You would use a GET request and enter the relevant URL along with your query parameters (e.g., the type of recipe you’re looking for). 

Make will then return a list of recipes that match your search criteria, complete with details like ingredients, preparation time, and even an image.

Step 3: Generating a Meal Plan

If you’re planning out meals for the weekend, you can request to generate a meal plan based on your dietary preferences, target calories, and more. 

The API will return a detailed meal plan with nutritional information, making it easy to stick to your goals while enjoying delicious meals.

Step 4: Computing Glycemic Load

For those who are health-conscious or managing their blood sugar levels, understanding the glycemic index of foods can be crucial. The Spoonacular API allows you to compute the glycemic load of specific ingredients or meals using a POST request. 

You simply input the ingredients, and the API will return the glycemic index and glycemic load for each item, along with the total glycemic load for the entire meal.

This feature is incredibly useful if you're planning meals and want to ensure they align with your dietary needs. 

For example, if you’re making a dish and want to know how it will affect your blood sugar levels, this API call provides the necessary data, helping you make informed decisions.

Step 5: Finding Ingredient Substitutes

With the Spoonacular API, you can make a GET request to find substitutes for ingredients you might not have on hand. 

For example, if you’re out of butter, the API can suggest alternatives like margarine or oil.

You can read the Spoonacular API documentation to check all available functions.

Important Tips for Working with APIs

While APIs are incredibly powerful, it’s important to handle them correctly to avoid errors. Always ensure your API requests are properly authenticated and formatted. Additionally, consider enabling advanced settings in Make to catch any errors in your API calls, ensuring your automation runs smoothly.

Key Takeaway

APIs are a game-changer for anyone looking to take their automation to the next level. By mastering API calls in Make, you can integrate apps that aren’t natively supported and create complex workflows that save you time and effort. Understanding how to work with APIs opens up a world of possibilities.

So why not give it a try this weekend? Start with something fun like exploring new recipes, and see how automation can make your life easier. 

And if you’re looking to dive even deeper into Make, consider checking out the Make Simplified Accelerator, where we cover everything you need to know about no-code automation using Make.

Read More Here: