# What block should i use to fetch data from WEB API like this

**URL:** <https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259>\
**Category:** Web API's\
**Tags:** design, beginner, help\
**Created:** [December 12, 2023, 4:52am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259 "2023-12-12T04:52:11Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![storeops1270](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@storeops1270](https://community.thunkable.com/u/storeops1270)\
**Post date:** [December 12, 2023, 4:52am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/1 "2023-12-12T04:52:11Z")

</div>

```auto
{
	"data": {
		"id": 1,
		"kategori": "Peralatan",
		"nama": "Monitor",
		"merek": "HP",
		"jenis": "APBD",
		"jumlah": "5",
		"tahun_anggaran": "2022",
		"foto": "kosong",
		"detail_barang": [
			{
				"id": 1,
				"kode_barang": "APBD-1",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 2,
				"kode_barang": "APBD-2",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 3,
				"kode_barang": "APBD-3",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 4,
				"kode_barang": "APBD-4",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 5,
				"kode_barang": "APBD-5",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			}
		]
	}
}

```

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 12, 2023, 6:30am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/2 "2023-12-12T06:30:20Z")

</div>

You will need to provide more details about what you’re trying to do.

You can start learning about APIs by watching my tutorial here: [API JSON Tutorial (Video)](https://community.thunkable.com/t/api-json-tutorial-video/1140575).

---

<div class="post-metadata">

**Author:** ![storeops1270](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@storeops1270](https://community.thunkable.com/u/storeops1270)\
**Post date:** [December 12, 2023, 9:50am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/3 "2023-12-12T09:50:13Z")

</div>

I want to to get data from my server and i confused to make the block

---

<div class="post-metadata">

**Author:** ![storeops1270](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@storeops1270](https://community.thunkable.com/u/storeops1270)\
**Post date:** [December 12, 2023, 12:44pm UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/4 "2023-12-12T12:44:18Z")

</div>

can you help fix it sir

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/9/3946ce893cf61e875e06cbfe694b687920fb558f.png)

HERE THE RESPON SERVER

```auto
{
	"data": {
		"id": 3,
		"kategori": "Peralatan",
		"nama": "Mouspad",
		"merek": "Logitech",
		"jenis": "ABDB",
		"jumlah": "5",
		"tahun_anggaran": "2023",
		"foto": "1702382167.png",
		"detail_barang": [
			{
				"id": 1,
				"kode_barang": "ABDB-1",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 2,
				"kode_barang": "ABDB-2",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 3,
				"kode_barang": "ABDB-3",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 4,
				"kode_barang": "ABDB-4",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			},
			{
				"id": 5,
				"kode_barang": "ABDB-5",
				"ruangan": "Lab MI",
				"kondisi": "Bagus"
			}
		]
	}
}

```

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 12, 2023, 7:13pm UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/5 "2023-12-12T19:13:22Z")

</div>

> [@storeops1270](#):
>
> can you help fix it sir

When I say that you need to give more details, you need to tell us which property:value pairs (for example, jenis”: “ABDB”) you are trying to get, and what happens when you try that. For example, what is the value of the green error block?

---

<div class="post-metadata">

**Author:** ![storeops1270](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@storeops1270](https://community.thunkable.com/u/storeops1270)\
**Post date:** [December 13, 2023, 2:13am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/6 "2023-12-13T02:13:38Z")

</div>

![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/3/f/3f54bb392842ecfe4b9b1ddd1f3405ed4e1af0d6.png)

i get data  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/1/0/102027dc112507d3587aefa6bd502dd49d4f70a1.png)

but when i change with ruangan i get null

---

<div class="post-metadata">

**Author:** ![storeops1270](https://avatars.discourse-cdn.com/v4/letter/s/34f0e0/32.png) [@storeops1270](https://community.thunkable.com/u/storeops1270)\
**Post date:** [December 13, 2023, 2:17am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/7 "2023-12-13T02:17:00Z")

</div>

if i change with detail\_barang i get looping object object

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/7/b/7b28234d95a15ada609ab0cebc39aa763088f94f.png)  
 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/9/7/977137c94bb18dbe1338e30eb50e3394946665ad.png)

---

<div class="post-metadata">

**Author:** ![tatiang](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/tatiang/32/55482_2.png) [@tatiang](https://community.thunkable.com/u/tatiang)\
**Post date:** [December 13, 2023, 5:51am UTC](https://community.thunkable.com/t/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/8 "2023-12-13T05:51:57Z")

</div>

There is no property named “jenis” in the “detail\_barang” list. Here’s the tree view from [Best JSON Viewer and JSON Beautifier Online](https://codebeautify.org/jsonviewer) using your JSON response:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/thunkable/original/3X/2/2/22800409502cc1d56e6ec094a89d8c493aeca09d.png)

When you get each item Barang in that list, the only properties you can then get are:

- “id”
- “kode\_barang”
- “ruangan”
- “kondisi”

You can try replacing “jenis” with “ruangan” but you need a wait block after the `set Label8's Text` block so that you can see each value as it loops.

My video tutorial explains how to do all of this and how to avoid the problems you’re having parsing the JSON response.

---

<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/what-block-should-i-use-to-fetch-data-from-web-api-like-this/2747259/9 "2024-11-08T13:33:13Z")

</div>


