Get metafields of Collection - ADMIN REST API

Solved
helidona
Tourist
18 0 2

Hi,

in the ADMIN API Documentation, there is an endpoint that retrieves a list of metafields that belong to a Product Image resource

GET /admin/api/2020-04/metafields.json?metafield[owner_id]=850703190&metafield[owner_resource]=product_image


I tried to modify in order to get the list of metafields that belongs to a Custom Collection, but the response from this endpoint returned me 'not found'
Here is how I have created 

GET /admin/api/metafields.json?metafield[owner_resource]=collection


Is this modification possible or does exist any other endpoint that retrieves a list of all metafields that are in collections?

I look forward to hearing back from you soon. 

Thank you

 

0 Likes
Jayvin
Shopify Partner
130 17 30

This is an accepted solution.

Hi Helidona,

 

That's not the way to proceed. You have to use this following endpoint:

/admin/collections/#{id}/metafields.json

More info here:

https://shopify.dev/docs/admin-api/rest/reference/metafield?api[version]=2020-04

 

0 Likes
helidona
Tourist
18 0 2

Hi @Jayvin,
I have used this endpoint for a specific collection, but my request was to get all of them without specifying the collection id. Hence, I hoped that would be another endpoint that will have that same solution as for Product Image endpoint.

Nevertheless, thank you again for your answer!

0 Likes