Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Rest API: Load Product Image Metafield

Rest API: Load Product Image Metafield

alessandro04
Shopify Partner
6 0 5

You can find documentation on how to add metafields to Product Images: https://shopify.dev/api/admin-rest/2021-10/resources/product-image#put-products-product-id-images-im...

 

But I can't seem to find documentation on how to load metafields for Product Images.

 

I've tried with:

/api/2022-04/products/{{product_id}}/images/metafields.json

/api/2022-04/images/{{image_id}}/metafields.json

 

But none of these seem to be working.

 

Anyone an idea on how to load Product Image metafields?

Replies 5 (5)

Shabalinski___A
Shopify Partner
21 4 2

Hi @alessandro04,

 

Look at this responses (for Variants images):

Look at this responses (for Product images):

After u get an 'image_id' u can request it from [GET] /admin/api/{api-version}/prodcts/{productId}/images/{imageId}.json

NOTE: To simplify this process, use the GraphQL AdminAPI

 

I hope this helps. If not, describe the problem in a little more detail, with code examples. 😉

Frontend (Shopify) Engineer at SpiralScout

  • - Was my reply helpful? Click Like to let me know!
  • - Was your question answered? Mark it as an Accepted Solution!
alessandro04
Shopify Partner
6 0 5

Your reply doesn't answer my question. The problem isn't about the image_id it's about Shopify lack of documentation to load metafields for an image.

Shabalinski___A
Shopify Partner
21 4 2

Oh, so, to request this data you need to use GraphQL API, u can see docs here.

Frontend (Shopify) Engineer at SpiralScout

  • - Was my reply helpful? Click Like to let me know!
  • - Was your question answered? Mark it as an Accepted Solution!
alessandro04
Shopify Partner
6 0 5

That's the point of my question, I want to use the Rest API for this not the GraphQL. And since there is documentation to create metafields on images through the Rest API there should be an option to load the metafields through the Rest API

Shabalinski___A
Shopify Partner
21 4 2

For REST API u can request it from:

NOTE: Read this article about GraphQL API, using the REST API in this case can shoot in your leg after a while.

Frontend (Shopify) Engineer at SpiralScout

  • - Was my reply helpful? Click Like to let me know!
  • - Was your question answered? Mark it as an Accepted Solution!