API GET records

Hi can any one help me to fix this problem

i want to connect data with my app by API i did that and i get the JOSN response

but now i need to create row for each items but it not work

Thank You

1 Like

You need to use the get object from JSON block instead of the generate JSON from object block.

If you still have trouble, post the full text of the JSON response here (not as a screenshot, actual text).

2 Likes

hi @tatiang thanks for your replay

i try what you say but its not work its giving me

[ object Object ]

this is the the full text of the JSON response

“{“records”:[{“id”:1,“Name”:“bader”,“created_at”:“2021-10-04T20:30:45.764Z”,“updated_at”:“2021-10-04T21:41:13.903Z”},{“id”:2,“Name”:“yazan”,“created_at”:“2021-10-04T21:39:29.511Z”,“updated_at”:“2021-10-04T21:41:08.218Z”}]}”

i have 3 record for each row
Name
created_at
updated_at

1 Like

That text is invalid JSON. Is there any way you can send me the Web API url you’re using? Or maybe try copying the text again and pasting it in Best JSON Viewer and JSON Beautifier Online? If you click “Tree Viewer” on that site, you should get formatted JSON that you can then post here as a screenshot. I’m just trying to confirm that your JSON is valid and so far it is not.

2 Likes

this the API URL

https://api.adalo.com/v0/apps/bc2e0083-b9f2-489e-a6bd-b8a3e60dea8e/collections/t_1iwgb957v1it20quwv5rylk9q

Authorization: Bearer 63nte6l7hui9ac1ifjlgdzhxi

Content-Type: application/json

1 Like

Thanks. Here’s the raw JSON response (I used Postman to generate it):

{“records”:[{“id”:1,“Name”:“bader”,“created_at”:“2021-10-04T20:30:45.764Z”,“updated_at”:“2021-10-04T21:41:13.903Z”},{“id”:2,“Name”:“yazan”,“created_at”:“2021-10-04T21:39:29.511Z”,“updated_at”:“2021-10-04T21:41:08.218Z”}]}

And formatted at codebeautify:

Your blocks for the “Name” property should work but not for the “Image” property because it doesn’t exist. What happens if you just assign the value of get property "Name" of object j to a label? Can you see the value then?

Edit: Actually, I think you’ll need to get the property name “records” first, then loop through that value as a list to get the “Name” property.

2 Likes

It not work at all I had tried everything

About property image I deleted it because of that
It’s not showing up in josn text

Your JSON is a list. You need first to convert the JSON to object then you need to loop using for each item in.... block using get property.... object block and use the name “records”.

2 Likes

“It not work at all” is really not helpful information. Post a screenshot of your blocks. Otherwise, there’s no way I can know what you’ve done wrong and how to fix it.

1 Like

Thank you munir for your reply
What you mean of ( use the name “records” )

1 Like

Use it in the get property "records" of object.... block.

I can show you an example later in the day.

1 Like

i mean i tried what you say but its not working

thank you

2 Likes

thank you munir that will be very helpful

1 Like

You are doing it wrong. It won’t work this way.

1 Like

okay so i will wait your example later today

@muneer & @tatiang thank you guys

1 Like

You’re close. Very helpful to see your screenshot!

Because the object has “records” at the top of the tree (in this screenshot), you need to first get the property “records” of app variable Get Value and set that to something like app variable Records List. Then, loop through for each item j in list with the list value being app variable Records List. And then get property "Name" of object j. Assign that to a label to see if the values are what you expect.

I’ll see if I can make you an example screenshot.

2 Likes

this difficult hhhhh :sweat_smile:

It looks so complicated, I don’t understand how to do it. Yes please, some screenshots will be very useful so that I understand what you mean

1 Like

See this quick sample

Output
image

I used the JSON string instead of the Web API just to make it simpler and faster to show.

Hope this can answer your question.

2 Likes

Muneer thank you so much for yor help its working now

@muneer & @tatiang thank you guys

2 Likes

Glad to hear that it’s working.

1 Like