How to deal with pagination? Shopify API

Hello,
I am using the Shopify API to download sales data. I am downloading sales data for one entire month and then using the SQL for JSON query to simply get the total amount of revenue.
The Shopify API limit is 250, so if there are more than 250 orders, I am downloading an incomplete set.

I have not needed to use pagination before so it is new to me. How can I set up my query so that I can download the entire result set and then query it using SQL for JSON?

I have attached both of my queries. 1 is used to connect to Shopify API, and the other to query this data using SQL.

I am not adding this data to a table or anything. I am just pulling all order data from Shopify and then summing the revenue to get a single revenue value, which I then display in a text box.

I have checked the Shopify API docs and it seems to use cursor-based pagination which provides a link to the next/previous page. However, I am not sure how I can use this within Retool. I just want to have one query that downloads my entire dataset essentially...


Hey, @happylinen!****

I think that ensuring your Shopify query is running until all results are returned is key here. Please check out this community post that I think will prove helpful with setting this up: http://community.retool.com/t/keep-running-rest-api-requests-until-all-results-are-returned-load-all-rows-from-an-airtable-api/2759