A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
My app is built on the node/react example. It currently gets lists of orders from the GraphQL API, which works well but requires that I add "write_orders" to my scopes. Since my app will never need to write to orders, and that permission may scare customers, I'd like to switch to the REST API, but can't get it to work.
The good news is I have been able to access the Orders Rest API to return the order count for my account (219 orders total):
https:/mystore.myshopify.com/admin/api/2020-07/orders/count.json
But when I try to get all orders using same token and this url I get a 200 response and an empty array:
https://mystore.myshopify.com/admin/api/2020-07/orders.json
• All of the orders in my test account are more than 60 days old, but my account has been upgraded to allow access to orders more than 60 days old, so that shouldn't be the problem.
• I've also tried a variety of parameters such as ?status=any, and still just get any empty array and a 200 response.
• I'm using the access token returned from ctx.session returned in the createShopifyAuth afterAuth callback, which works for orders/count.json not problem.
• I get same result using Postman.
Hey @CRandyHill
Once your account is granted the scope to allow for all orders, you would need to request that scope via OAuth as per this post.
Kevin_A | Solutions Engineer @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Kevin,
Thanks for the reply. Yea, the problem appears to be I'm not asking for "read_all_orders" in my scopes. I've been pulled away to another project for the moment but will test to confirm and post an update when I do.
best wishes,
Randy
Yes, that was my problem. So for others, to access more than 60 days through the REST API you both have to get approval from Shopify customer support, you also need to add "read_all_orders" to your scope.