Sorting pagination

Solved
Shopify Expert
6 0 4

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?

moving primates GmbH • https://www.movingprimates.de • https://www.shopify-agentur.de
0 Likes
Shopify Staff
Shopify Staff
135 22 26

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

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted

Success.

Shopify Expert
6 0 4

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 ?

 

 

moving primates GmbH • https://www.movingprimates.de • https://www.shopify-agentur.de
0 Likes
Shopify Staff
Shopify Staff
135 22 26

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).

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes