Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Re: Orders API

Orders API

thelippyj
Visitor
2 0 0

I'm trying to query all orders that were fulfilled on the previous day however I'm having issues with the pagination.

I query the orders endpoint with the following parameters.

status: closed
fulfillment_status: fulfilled
created_at_min: December 1 2019 12am
updated_at_min: yesterday 12am
updated_at_max: today 12am
limit: 250
fields: id, line_items, shipping_address

Note: All date fields are correctly formatted

After the first query and 250 items are returned I then add in the since_id as required in the docs.

My next set of items are only 249 and if I update the since_id it returns an empty array for orders leaving the total orders to be 499 returned.

If I update the limit to 50 i have the same issues with a total of 99 orders returned.

Is there something i'm missing on the pagination?

Replies 2 (2)

Gregarican
Shopify Partner
1033 86 292

If you are using the REST API then there is now cursor-based pagination that can be used. Described here --> https://shopify.dev/tutorials/make-paginated-requests-to-rest-admin-api. Hope this helps!

thelippyj
Visitor
2 0 0

Thanks for the response. I'll look into it further and hopefully I can find a solution that works with it.