Order api only shows last 50 Orders. How can I make it show them all ?

Solved
TonyJ
Excursionist
16 1 0

Hello

Maybe someone can easyls help here

https://......myshopify.com/admin/api/2020-10/orders.json?fulfillment_status=fulfilled&location_id=x...

Will only return the lastest 50 Orders. How Can i change the behaviour oF API only to consider really what is given as Filter parameter?
Any helüp very much welcome. BR. TJ

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 238

If orders are older than 60 days and your API credentials don't have that granted access then this could be why. Check here for specifics --> https://shopify.dev/docs/admin-api/rest/reference/orders/order

0 Likes
garyrgilbert
Explorer
54 5 13

50 is the default if you don't add the "limit" parameter to your URL

250 is the  maximum .. the results are also paged so in the http response header you will have to check to see if you have a "previous" or "next" url and follow that url to get the previous/next chunk of results..  

so in your case:

https://myshopify.com/admin/api/2020-10/orders.json?fulfillment_status=fulfilled&location_id=xxxxxxx...

 

btw location_id won't filter anything since see here for available parameters

https://shopify.dev/docs/admin-api/rest/reference/orders/order#index-2021-01

any parameters not in that table will be ignored.. sadly.. I am also looking to filter the orders by location_id

 

Cheers,

 

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
0 Likes
TonyJ
Excursionist
16 1 0

Greg, Thanks for the hint

0 Likes
TonyJ
Excursionist
16 1 0

This is an accepted solution.

Hey Gary, Thanks, So if there is no way to GET ALL the orders other than thecking the Response header, I dont know if I can use this API really

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 238

@TonyJ I don't know how many other API providers you've worked with, but most of their REST implementation employ some type of paginated response sets. With Shopify's GraphQL API, you can issue a bulk operation request and then download a JSONL file with all the records. That's an option.

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 238
garyrgilbert
Explorer
54 5 13

 

Why would you need to get all the orders? What is your use case for needing to return all orders?

I can't think of any off the top of my head? As Greg already answered most modern rest api's will have some kind of paged response in order to limit resource usage on their end.. think of a very popular store with perhaps millions of orders in a year.. 

select * from .. not the best idea from an implementation perspective.

 

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
0 Likes
TonyJ
Excursionist
16 1 0

OK. Thanks anyway. Doesnt make it easyier. Reasaon is, I can as of know only use a middleware to put requests to the API automatically. but sniffing the http response header for the the next results will be imposiible to implement with this tool. BR

0 Likes
Greg_Kujawa
Shopify Partner
1016 83 238

@garyrgilbert there are occasional one-off needs for this scenario. One example that comes to mind is when a large data conversion is taking place. First thing I do is pull all records, then only delta sync records over a polling period. Like when I had to initially pull all Shopify products to push over into Lightspeed Retail *shudder*.  

In that case, if it's a choice between parsing Shopify REST API response headers to advance pages versus a one-shot Shopify GraphQL API bulk operations request, I'll go GQL every time. Just download the JSONL results file with everything in there and be done with it.

0 Likes