Discussing APIs and development related to customers, discounts, and order management.
Hello
Maybe someone can easyls help here
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
Solved! Go to the solution
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
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.
Greg, Thanks for the hint
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:
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
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
@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.
See https://shopify.dev/tutorials/perform-bulk-operations-with-admin-api for details.
Hello, How do I write a bulk mutation for Graphql that just gives me all the orders?
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!
Hello Greg
Is it possible to create a bulk query to return all orders with all atributes?
Thanks for any idea
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
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.
@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.
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
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
@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