A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more
Hello,
I' looking for some documentation about the "order" parameter on the Admin API
In the example https://www.shopify.com/partners/blog/relative-pagination there is a "order" parameter mentioned.
https://shop-domain.myshopify.com/admin/api/2019-07/products.json?order=inventory_total+desc&limit=250
I didn't find this param in the Admin API reference.
Is the order param also available for orders and others endpoints?
And what are the possible values?
Solved! Go to the solution
This is an accepted solution.
Pretty sure it's supported on the admin graphql api - https://help.shopify.com/en/api/graphql-admin-api/reference/object/productsortkeys
Order Sort Keys: https://help.shopify.com/en/api/graphql-admin-api/reference/object/ordersortkeys
Customer Sort Keys: https://help.shopify.com/en/api/graphql-admin-api/reference/object/customersortkeys
Hey @Jiri_Hacmac ,
This parameter is unsupported by Shopify, and as a result it may change or stop working at any time. Use at your own discretion
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Pretty sure it's supported on the admin graphql api - https://help.shopify.com/en/api/graphql-admin-api/reference/object/productsortkeys
Order Sort Keys: https://help.shopify.com/en/api/graphql-admin-api/reference/object/ordersortkeys
Customer Sort Keys: https://help.shopify.com/en/api/graphql-admin-api/reference/object/customersortkeys
Hey @hassain
can you please verify it that it is not supported for REST admin API?
Does it mean, I have to use Qraphql to get sorted results?
What is the default sort order for GET/admin/api/2019-10/orders.json ?
Hi @Jiri_Hacmac
Yes, I can confirm that using the GraphQL Admin API is the supported and ideal method of getting sorted results from Shopify.
From my knowledge, the default sort order of the orders.json REST endpoint is the "id" field in ascending order. The "id" is generated incrementally every time an order occurs on Shopify, so you can also intepret this sort order and ordered by the "created_at" date time in ascending order (i.e. older order first).
To learn more visit the Shopify Help Center or the Community Blog.