I give up. I have watched the girls tutorial videos of using Api a dozen times and I do not see what I’m missing. I stumbled on a working combination of blocks a few days ago but ended up deleting everything.(Thunkable please add an undelete button.) I simply want to enter in a drink name then click the button. The app gets the drink name from text input searches for drink and gets drink instructions.
So I’ll just say that APIs are complicated. What you’re wanting to do sounds easy and straightforward. And it’s not terribly hard relative to some APIs but it does take a few extra steps beyond what you’ve tried.
To start with, the JSON object is returning a property called “drinks” that contains an array. In Thunkable, you have to access this using list blocks. So just getting the value of “drinks” from the object, as you’ve done, isn’t going to work.
I know nobody wants to be told to go watch a video but I think you’ll find my tutorial pretty helpful:
If that gets you a little further and you still have questions, post an update here…
Try this:
I dealt with the fact that you’re getting multiple drink objects returned by just showing the first one. That may be the wrong choice, but at least this shows you how to get data out of that json array?
Now, let me tell you what I did:
I looked at your sample JSON and saw that your outermost category was ‘drinks’, so I started with the stuff on the right: Get property “drinks” of object (get object from JSON response).
Then I looked at what was inside drinks and saw the square brackets, which told me that what was in drinks was an array, so I handled that like a list, and just grabbed the first item (I’m going to call it your “first drink object”, ok?) from the list.
Continuing to work inwards, I found inside { } a whole bunch of information about the first drink object, so I got property “strInstructions” of that drink object.
And there you have it. I’m working through the JSON from outside to inside, but building the blocks backwards, from right to left.
See this post talking about same API.
Hey @scottbrown46383u - which video were you watching?