Can a product's collections be viewed during a Get request to the products endpoint?

I know it’s possible to retrieve custom-collections from its endpoint. I’m wandering if it’s possible to see the collections a product belongs to when making a Get request to the products endpoint? This way I don’t have to make another external API call.

Apologies if this is obvious but I’ve looked on the Product JSON response object and can’t find it.

Thanks.

Hi,

You are looking for the collect endpoint. https://shopify.dev/docs/admin-api/rest/reference/products/collect

GET /admin/api/2021-01/collects.json?product_id=XXXXXXXXX

Apologies I don’t think I was clear. I want to be able to make a get request for all products:

/admin/api/2021-01/products.json

… and within the response to see, for each product, which collections they belong to.

Hi,

With the rest api, you first need to get all the products and then loop through the products and get the collects for each of them. What you want does not exist in rest api.

Maybe you should have a look at the graphql product endpoints.