REST API Calls with n8n

To follow along with this tutorial you need to first know how to make your API calls with n8n. We will not cover it in this article, but we already have one covering it, so if you do not know how to do it, click here.

If you don’t know what n8n is, you should start here.

Automate REST API Calls “on Schedule”

If you have your n8n HTTP Node set up, we can start diving into how to make the call recurring. As you know, n8n is a workflow engine, and because the HTTP node is our whole workflow right now, we can think of making API Calls as running the workflow.

There are different ways to run (execute) a workflow in n8n. All the nodes that start a workflow are called “Trigger”. You can start workflows when specific actions in other applications happen, when other workflows run, or when errors occur. But to run them daily or hourly, we need to pick the “On Schedule” Trigger.

On a Schedule n8n trigger node
Run n8n Workflows On a Schedule

If you selected the On a Schedule Trigger, you have two main parameters you have to choose. You need to choose a “Trigger Interval”, which describes the time unit you want to work with.

Basically, the more often you want your workflow to run, the smaller the time unit should be. Theoretically, you can also map every larger time unit with every smaller time unit, but this makes the settings a little more complex.

defining parameters of the n8n on a schedule trigger node
The “On a Schedule” Trigger Node

For example, we now want to query our API every hour at half past every hour to find out the current weather. To do this, we select Hours as the “Trigger Interval”, 1 for “Hours Between Triggers” and “Trigger at Minute” 30.

Now there are just 2 steps left until we are ready and we automated our API Calls. First you have to connect the Trigger Node with your HTTP Node in the n8n workflow canvas. You can do that by dragging and dropping the + on the right side of the Trigger Node to the left side of the HTTP Node.

connecting the trigger with the http node
Connected Trigger & HTTP Node

Last but not least you have to toggle the switch in the top right corner of your canvas from inactive to active.

Now you are done and your workflow, and therefore your API call will be executed on the schedule you defined. You will see the output of your workflows in the Executions tab of your workflow or profile.

Leave a comment

popular