How do i get this to work, i did not find any "native" pagination methods/fields in rest api configuration in order to "loop" trough the "next_url" in the api response.
It seems there are many threads regarding "table component server-side pagination but did not find any regarding the good'ol rest api call.
I think you can accomplish this with a custom JS Query which triggers an API query asynchronously. You'd be triggering the API within a loop (a while-loop, most likely) and only completing the loop when next_url is null (or missing from the return data). You may want to have an initial query (firstQuery) that is run which then triggers this loop (when the response data contains next_url This would probably look a little something like:
let aNextUrl = firstQuery.data.next_url;
let limitValue = 10000;
let allResults = firstQuery.data;
let next = true;
while (next)
{
const resp = await yourNextAPIQuery.trigger({
additionalScope: {
nextUrl: aNextUrl,
limit: limitValue
}
});
if(resp.data.next_url) {
aNextUrl = resp.data.next_url;
allResults.push(resp.data);
}
else { next = false; }
}
return allResults;
You'll have to setup the triggered API query to use whatever additionalScope variables you send and then use those in the URL params of the query. Using the ones above, you'd have {{nextUrl}} and {{limit}} in the spots you need to use that data.
I ended up doing this with python block in a workflow, but similar idea you had.
btw, why there is no python block/queries available in the app builder, only in workflow, do you have any idea?
btw2: is there any "native" way to trigger app queries after a workflow has run? Example: workflow put data in retoolDB --> in the app there is a table which i just want to refresh after the workflow has run.
I don't believe this was on the roadmap for the Apps as of last year but I'm not sure about the current plans to make this available in an App. Going through a workflow is the usual path, which leads to your btw2:
In your workflow you can setup a response node to send back data to the triggering app. In your workflow query you set up a success event handler to then trigger the refreshed data sources.
if there is NO response node in the workflow the app query is "success" when it manages to run itself, ie. start the workflow --> too early for table refresh
if there IS response node in the workflow the app query is "success" when it gets a response, ie. in the end of the workflow --> correct time to do table refresh