I have been working with the shopify_app gem this past week to create a public application. Currently I have Webhooks set that whenever an order is created by a shop that has installed my app, my app then receives the webhook and am able to store the order in my database.
This is great, but I would like to gather all orders a shop has created when they install the application. And possibly at some point in the future after my application has already been installed.
I am confused as to if I should be using the shopify_app gem (or possibly shopify_api) to do this, or it possibly seems as thought I should be using GraphQL to query all orders (as the REST API has a limit?)
I fully anticipate looking back at this question and thinking it was dumb. But I have spent the majority of today researching to no avail. In 2020, should I be using GraphQL to do this, or writing my own job to fetch this data?
Thanks for your thoughts.
Shopify no longer allows you to download all the orders of a Shop. When you create an App that is one of the key things you can ask for. If you can justify needing all the orders of a shop, and Shopify believes your reason is just, they add that as an extra doo-hickey on the scopes, and you can get at old orders. Otherwise, you are sitting on a few old ones from recent history, and fresh new ones.
Both RestAPI and GraphQL offer you access to orders. The limits you seem confused about concern how many requests you can make in a period of time. The RestAPI is throttled so that you cannot flood it with requests beyond a reasonable number. GraphQL has different limits in that a query has a complexity number, and you can only burn through credits if you have them. You gain credits used as time passes.
GraphQL is much better, so if you're just starting out, use that. You'll get a lot more mileage for a lot longer. Also, with GraphQL you can ask for orders in bulk and get a nice JSONL file with ALL the orders possible in a file. So much better for your work.
@HunkyBill Thank you for your response. I was just approved by Shopify to view all orders.
One question: would I then be able to access the GraphQL through the shopify_app gem? Or is there something else I should be looking at for GraphQL to play nice in a ruby/rails environment? Working with shopify_app and GraphQL are all pretty new to me. I’m used to RESTful API’s...