# Getting started with API blocks

**URL:** <https://community.thunkable.com/t/getting-started-with-api-blocks/2600687>\
**Category:** Tutorials and DIY Guides\
**Tags:** community, webapi, intermediate, tutorial\
**Created:** [September 18, 2023, 5:56am UTC](https://community.thunkable.com/t/getting-started-with-api-blocks/2600687 "2023-09-18T05:56:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![vishruth-ram](https://avatars.discourse-cdn.com/v4/letter/v/82dd89/32.png) [@vishruth-ram](https://community.thunkable.com/u/vishruth-ram)\
**Post date:** [September 18, 2023, 5:56am UTC](https://community.thunkable.com/t/getting-started-with-api-blocks/2600687/1 "2023-09-18T05:56:22Z")

</div>

Before you come here read this:

> [@JSON / Object Tutorial](https://community.thunkable.com/t/json-object-tutorial/1085666/):
>
> Working with JSON data is a common Thunkable Discussion topic. Here I will try to answer the most common questions and provide solutions to the most common problems. This tutiorial has six parts: [Basic JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/2)[JSON Errors](https://community.thunkable.com/t/json-object-tutorial/1085666/)[Intermediate JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/4)[Advanced JSON](https://community.thunkable.com/t/json-object-tutorial/1085666/5)[Firebase Realtime DB and Cloud Variables](https://community.thunkable.com/t/json-object-tutorial/1085666/6)[Web API](https://community.thunkable.com/t/json-object-tutorial/1085666/7) The companion project with all examples can be [found here](https://x.thunkable.com/projectPage/601efcc715209c1fd57a3921).

Since thunkable’s API is based on [postman](https://postman.co), 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.

```auto
'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

```auto
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:

 ![Screenshot 2023-09-18 112231](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/a/1/a11172ecbe206c1bb6e25e014b9cdb39ef6f775c.png)  
For this code, we want to insert Dynamic Values in the `Location` Parameter.

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

```

* * *

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 1:33pm UTC](https://community.thunkable.com/t/getting-started-with-api-blocks/2600687/2 "2024-11-08T13:33:26Z")

</div>


