Do you want to insert the whole JSON response into a field, or convert the JSON into useable data that you can insert various data points into various fields?
First you’ll need to unravel the data from the JSON on the Server Action - there is a reported bug currently that nested JSON is not showing in it’s entirety. My workaround is to manually build the schema (or add to it) in the API output, or use a Set Value. Others will recommend a repeat for this.
I’d say if you have few fields, but large rows of data then repeat on the data then a multi-insert is probably how you would do it.
I’ve used the Set Value to construct the schema in a way I want to display on a page, but I think in your case as your schema is returning fine a repeat with insert or multi-insert would work on it so you can insert each row independently.
So
API Action
Core > Repeat
Within the repeat Action > insert or multi-insert
Reason being is you have multiple rows of data from the same data source that you need to repeat through and insert in one action.
I’d assume someone else will jump in for the correct Wappler way, but from what I understand this would be the optimum way to do so.
Wow. Working with APIs a bit recently and Wappler has just really impressed me… (thanks @George@Teodor and @patrick .
Apart from figuring out how to work with APIs, schemas, JSON etc, it has been really easy and Wappler has been able to just WORK. Creating complex JSON structures just with the right combination of SC actions. Easy.
And now, after a TINY bit of playing around, it was super simple to get this to work and automatically insert all the records I got from this API into my DB. The trick (thanks @mgaussie) was just to use the API as a repeat…simple.
Hi @Philip_J
as @mgaussie explained that’s exactly how you handle data manipulation of multiple records.
That’s why the repeat component is used. It can be useful for looping through records and do inserts/update or looping through multiple files on upload and manipulate them, also for looping through CSV import etc.
Of course… don’t get me wrong, I’m very familiar with Repeats
I just wasn’t seeing how to use the API schema for values/inputs. I’m not sure if I didn’t look properly at first, or if the schema hadn’t been properly defined, but when i went back to it today (using a repeat) it was all so simple.