Category: How do I do X?
Updated

This solution is summarized from an archived support forum post. This information may have changed. If you notice an error, please let us know in Discord.

How to store multiple pages of API results in one Query?

Issue

I am trying to fetch a large list of Jira issues from an API endpoint using the Jira REST API. However, the maximum page size the API supports is 100, which is less than I need to have available "locally". I am looking for a best practice solution that would allow me to execute an AppSmith Query multiple times, fetch all the pages I need, and store them for future usage. I cannot use server-side paging on top of some Table widget and need to have all N pages of the Jira API results present locally to do additional aggregations on them.

Resolution

The problem was that the maximum page size the Jira REST API supports is 100, which was less than what was needed locally. The solution was to use Promise.all(), which allowed the queries to be run multiple times and the results to be merged together for future usage.

To achieve this, a JsObject was created with a query called GET_ISSUES_FROM_JIRA, which had parameters that were referenced within the query. The JsObject then ran the query multiple times in a loop with incrementally larger startAt parameters.

Overall, this approach worked well and was a best-practice solution for handling large sets of data in the Jira API. No code examples were provided in the conversation, but the steps outlined are straightforward enough for implementation.