Best implementation I have come up with so far as it does not require the temporary database table, however it is a bit slow as the API calls can not run in parallel, and you need the custom Merge Array module added to Wappler.
The test API Provider is a bit of a horrible one because it does not give you all the information some API's do, such as how many records there are in total, and it also does not give a link to a next or previous page as many other API Providers do.
Steps
- API Action to fetch the first batch of records needed, in my case API Providers limit is 100 results, and my offset is 0 to start at the first record.
-- ID:api1
- SetValue --- Name:
firstRecords, Global Name:firstRecords, Value:api.data.products(This is an Array)
- SetValue --- Name:
lastRun, Global Name:lastRun, Value:1
- While Loop -- Condition: lastRun==1
-- API Action to fetch second batch of records, ID: api2, offset: {{firstRecords.count()}}
-- SetValue --- Name:set_firstRecords, Global Name:firstRecords, Value:{{firstRecords.merge_array(api2.data.products)}}
-- SetValue --- Name:set_lastRun, Global Name:lastRun, Value:{{(api2.data.products.count()==100) ? 1 : 0}}
- Out of While Loop
-- SetValue --- Name: 'products_holder, Global Name: NOT SET, Value:{{firstRecords}}`
On run I get a single array with 350 results, which means the API is being called 4 times in total, making the results take about 6-8 seconds.
@Teodor is there any way you can think of to improve this?