Solved

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

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

Accepted Solution (1)
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

View solution in original post

Replies 15 (15)

Gregarican
Shopify Partner
1033 86 285

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

TonyJ
Excursionist
16 1 0

Greg, Thanks for the hint

garyrgilbert
Shopify Partner
391 40 162

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
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

Gregarican
Shopify Partner
1033 86 285

@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.

Gregarican
Shopify Partner
1033 86 285
TonyJ
Excursionist
16 1 0

Hello, How do I write a bulk mutation for Graphql that just gives me all the orders?

Gregarican
Shopify Partner
1033 86 285

If you're going to learn the API and have to maintain things moving forward, it's better to teach a man how to fish rather just toss him one. If you "own" the Shopify shop, then install the GraphiQL app --> https://shopify.dev/tools/graphiql-admin-api. It's an interactive playground where you can start working with GQL. Plus it has auto-complete and other features to help guide you. The API documentation has examples of various scenarios as well. It's a good start!

TonyJ
Excursionist
16 1 0

Hello Greg

Is it possible to create a bulk query to return all orders with all atributes?

https://community.shopify.com/c/Shopify-APIs-SDKs/How-does-a-bulk-query-for-Orders-with-all-attribut...

Thanks for any idea

 

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

garyrgilbert
Shopify Partner
391 40 162

 

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
Gregarican
Shopify Partner
1033 86 285

@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.

TonyJ
Excursionist
16 1 0

I think , that will do. We dont have a lot of orders now but we need them All in a initial step. I will try GQL

garyrgilbert
Shopify Partner
391 40 162

Tony, if this is "your" shop or you have access to the shop then you can export (csv) all the orders if you only need to do it once. (top right-hand corner in the orders list).. then you can set up a webhook to push new orders to your app (private app).. otherwise either graphql or you inspect the response header like I do

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
garyrgilbert
Shopify Partner
391 40 162

 

@Gregarican I definitely see the need to pull all products.. I'm working on an app where I will have to do just that (for a fulfillment center).. Parsing the response header is actually quite easy, but yeah for a huge amount of products it would tie up a thread for quite a while.. I will have to look into the bulk operations link you posted above.

 

Cheers,

Gary

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution