How to sort the products in a collection? - REST API

Hello there,

I try to sort the products in a collection with a script, but I don’t get it.

A collect is an object that has been assigned to a collection, or am I wrong here? So at first, I check my Collection for all products

Get all the Products of Collection with:

https://some_shop_name.myshopify.com/admin/api/2023-04/collections/123456789/products.json

Result:

{ “products”: [ { “id”: Product_ID, “title”: “Some nice Product”,…

After that, i try so search for the collect with the product ID from collection, but the result is empty

https://some_shop_name.myshopify.com/admin/api/2023-04/collects.json?product_id={Product_ID}

Result:

{“collects”:}

So what do I have to do to re-sort all products of a collection?

Thanks for helping out

Does no one have an idea or is there an error?

Hi @NeroNekro :waving_hand:

The Collect resource connects a product to a custom collection. Given that /collections/123/products.json returns both smart and custom collections, it’s possible that the product ID passed in /collects.json?product_id={Product_ID} is only included in smart collections. In which case, it would expected for it to return an empty list of collects.

Hope that helps!