Hi Guy,
I try to learn API in thunkable and sample api is book. i am not sure why is not return anything.
Here the url and my block.
url : https://api.alquran.cloud/v1/ayah/262
block

Hi Guy,
I try to learn API in thunkable and sample api is book. i am not sure why is not return anything.
Here the url and my block.
url : https://api.alquran.cloud/v1/ayah/262
block

you have to drill downa few more levels:
see the additional (nested) blocks iâve used:
here is my output
you could also use this notation (my preferred):
note that you donât have to nest blocks - one level is needed but the full âpathâ in the the json tree needs to be provided - concatenated by dot. if an array is involved,it could be coded, for example data.book[1].number
Hi @manyone
thank you for your guidance. so most important i have to understand how the json is formatted right? i try to use json formatter and it make sense.
Hi @manyone
if i want to get following text does not seem work. if you can advice me how the block look like.

my block
instead of get property âayahsâ, you should try get_property âayahs[1]â (because ayahs is an array (you can tell because it starts with â[â
i f you want to handle arrays dynamically so you donât have to pre-count how many elements in an array,
use the method used here:
study the way the âfor each itemâ block is used to loop thru the array. you will have to do a similar thing.
note the level of nesting for ayah
hereâs the result
hereâs another way of handing the json structure by using a count block - note how blocks nest
this time, using a short cut notation
finally, here is the first version (at the top) expressed in short cut notation (note âdata.ayahsâ, compare to the first version)
all of these produce the same output
hereâs the link to the toy project (refer to screen 3)
https://x.thunkable.com/copy/93ec9cf50be75dcefd5986ab596bf439
It worked for me. thank you for your help.
I have curiosity about your method, why not using url instead of using json format in the block?
itâs just a debugging technique.
i knew i was going to do a lot of trial and error so i copied the results of the first call and saved it - and used it every time i tested my changes.
if i had used the api call in my block - i would have been calling the api every single time and most likely it woud have returned the same value. also if the api call had a price - i would be charged for every call.
itâs just a way of saving time. after iâm done i could restore the âget dataâ portion back to the usual get-api call.