REST Admin API 'products that belong to a certain collection' order

Highlighted
Shopify Partner
8 0 0

I'm using the REST Admin API https://shopify.dev/docs/admin-api/rest/reference and there doesn't seem to be a SORT method/parameter.

 

I am using the ENDPOINT: 'Retrieve all products that belong to a certain collection' which is `/admin/api/2020-04/products.json?collection_id=841564295` but the order doesn't match the manual order on Shopify?

 

Can you help?

0 Likes
Highlighted
Shopify Partner
8 0 0

Even if I use the `collects.json` to give me a list of products and then use those product IDs to query `products.json?ids=4967442317449,4967475478665` the order is still not set by that order.

 

Can someone please give me some information on this?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

Hey @a-ok 

 

The collections endpoint doesn't accept an id parameter.

 

/admin/api/2020-04/collections/#{collection_id}/products.json returns products which are sorted by the collection's sort order.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes
Highlighted
Shopify Partner
8 0 0
Indeed BUT this doesn’t include product variants 🤦🏻‍♂️
0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 167

That will require an additional call. Alternatively consider using the GraphQL API.

Notice; Out of office, replies will be delayed until my return. Thanks!
0 Likes