Solved

Get metafields of Collection - ADMIN REST API

helidona
Excursionist
19 0 5

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

 

Accepted Solution (1)

Jayvin
Shopify Partner
284 42 89

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

 

banned

View solution in original post

Replies 2 (2)

Jayvin
Shopify Partner
284 42 89

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

 

banned
helidona
Excursionist
19 0 5

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!