There are no issues with arrays that have keys, but when the items are top level like in “interests” I get nothing returned. Assuming I need to handle this type of response in a different way somehow? In the image below, title returns perfectly fine.
The issue I’m facing is that the api call returns no items when there are no keys in the array.
If I call the end point outside Wappler, the call returns items under interests. But when making the same api call inside wappler through a server action - api action it returns no items.
However, the second example above “activities” where the 5 items have keys, I’m able to retrieve each item. for example "title: “yesterday was…”
Another example, in the image below. I can retrieve activities - title. But I can’t retrieve items under “recommendations”.
Since I’m not sure why this is happening, my first thought was that since everything is stored directly under “recommendations” but as keys under “activities”, perhaps I need to handle “recommendations” differently?
What is that api? Is this some 3rd party remote api that you are connecting to using the api action step, or a server action created in Wappler?
Have you tried running the server action in your browser directly to see the results?
Is it just the data picker on your page (i can’t understnad what part of Wappler UI your screenshot is showing) that doesn’t show the items?
I’m not being very clear at all. Let me rephrase it
Yes, this is a 3rd party external api. I have tried it in three different ways, to sanity check myself.
calling the api using the “api action” under “server actions” and then trying to display the retrieved data on a page with a server connect.
calling the api using the “api action” under “server actions”, followed by a database insert saving the returned data to my db.
running the server action directly in browser to see the result.
All three behaves the same way. Data that are direct items in an array, e.g. “recommendations”, returns nothing, but items with a key in an array returns the expected data, e.g. “activities”
Screenshot of the basic set up, just calling the api and then viewing the response in the browser.
And to triple check that for example “recommendations” actually contains data, I have made the same call in a couple of api playgrounds outside of wappler. So I know that there is data there. My initial thought then was, maybe this shouldn’t be set to type array in the field properties in the schema editor. But after having tried all options there, “object” etc. I’m not sure what else to try.
Oh boy, I thoroughly apologise for wasting your time Teodor. I only just now when going back reading the API documentation noticed (nicely hidden) that some of these queries needs to be defined in the call to specifically be included (because they cost more). And… as it turns out. All the ones I’ve been looking at falls in that category.
Happy Monday tho… sorry about that. Feel free to delete this thread or leave it as a warning for future dimwits like me.
As a side note: interesting that the playgrounds I tried outside wappler defaulted all queries to include, without setting them manually. That will bankrupt you quickly Wappler wins again.