问题
This question is very closely related to Sort Order of Shopify REST Collections but the answer for that question was specific to the since_id
parameter.
My question is what is the expected sort order for order collections over the API when updated_at_min
or updated_at_max
are provided?
What would be ideal would be to be able to get results in ascending order one way or another, but without having to pass in since_id
, because we want to be able to pull in new data on orders on an ongoing basis as they may be updated.
回答1:
This is an old question but for anyone interested its possible to sort the orders collection by passing an "order" parameter. The "order" parameter should contain the field to sort by (supported fields are "created_at", "updated_at" and "processed_at"), followed by a space and then by an "asc" or "desc".
For example check the call below:
https://abc.myshopify.com/admin/orders.json?limit=2&fields=id,note,created_at&order=created_at%20asc
This will sort orders by the created_at date in ascending order.
来源:https://stackoverflow.com/questions/15766479/how-are-shopify-api-order-collections-sorted-when-passing-in-an-updated-at-filte