I'm currently building a product requires syncing a Shopify customer's orders to our database. In order to do this, I need to pull all orders using the Order API, and then every day get all the new orders that were added or updated.
In order to do this, I need to order the results of the Order API by "updated_at asc" and then use the "since_id" to make sure I'm pulling exactly all orders after a certain ID. I saw on an old answer on this forum that you can use the "order" argument to order the results. It seems to work, but when I use it with "since_id" it gives incorrect results.
A few questions:
Solved! Go to the solution
Why do you need the orders sorted by date? If it is just a matter of getting newly created or updated orders per day, you can query orders by date range for updated_at like so
But if you still insist on sorting by date, you can as mentioned in the referenced post
@KarlOffenberger The reason that I need to fetch orders sorted by date is because I only want to pull orders that have been created/updated since last I pulled. The issue arises when I combine the "order" query argument with the "since_id" query argument.
The specific reason I need to use "since_id" is because there could be 250 (the maximum result amount) orders with the same "updated_at" value. In order to pull all of them, and make sure I don't miss any orders, I'll need to include a since_id to paginate through the results. Any ideas on how to solve this problem?
@KarlOffenberger you're right, that solution makes a lot of sense. I'll look into it.
Do you happen to know if the "order" and "page" arguments will be officially supported by Shopify? I noticed that they seem to work when I send them, but they're not listed on the API page.
|an hour ago|