Getting started with API blocks

Before you come here read this:

Since thunkable’s API is based on postman, and many API docs don’t include how to work with Postman, this topic covers How to convert a cURL command to blocks.

Identifying Headers

In a cURL command, we use ---headers to tell we are adding a header.

'Accept: application/json'

The word before the colon will go in the Parameter section in thunkable. The remaining part will go into values.

Setting URLs and commands

curl --silent --location 'https://api.tomorrow.io/v4/weather/realtime?location=toronto&apikey=API Key' \
--header 'Accept: application/json'

In this, we are setting the URL

Indentifying GET, POST etc.

The word -X POST means we are making a POST request. -h is the starting of a URL. if you want to put extra information into the call, it is not possible with Thunkable now.

If there is no word, it means a GET request. The term GET is also used to symbolise a GET request.

Dynamic Values in URLs

When we want to insert data in thunkable to a URL, we can use the join block from the text section.
This is an image of entering dynamic values:


For this code, we want to insert Dynamic Values in the Location Parameter.

curl --location 'https://api.tomorrow.io/v4/weather/realtime?location=toronto&apikey=My API key' \
--header 'Accept: application/json'