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.

Add media on Metafield Product - Get error : must be a file reference string.

Solved

Add media on Metafield Product - Get error : must be a file reference string.

thinkcloud
Shopify Partner
8 0 0

Hello everyone, I'm trying to send an image of my products (product/images[1]/admin_graphql_api_id in a product metafield, but I get the error "must be a file reference string", I don't understand where is the problem coming from, does anyone have any advice?

My API REST call is : POST 



Capture d'écran 2023-12-05 075705.png

Accepted Solution (1)
SBD_
Shopify Staff
1831 273 423

This is an accepted solution.

Hey @thinkcloud 

 

Unfortunately I think these are only accessible via the GraphQL API.

 

{
  products(first:10) {
		nodes {
			id
			media(first:10) {
				nodes {
					id
				}
			}
		}
	}
}

Scott | Developer Advocate @ Shopify 

View solution in original post

Replies 6 (6)

SBD_
Shopify Staff
1831 273 423

Hey @thinkcloud 

 

Checking with the metafield folks and will report back.

Scott | Developer Advocate @ Shopify 

thinkcloud
Shopify Partner
8 0 0

Hi, Do you have ideas ? :c

SBD_
Shopify Staff
1831 273 423

Hey @thinkcloud 

 

Chasing this one up.

Scott | Developer Advocate @ Shopify 

SBD_
Shopify Staff
1831 273 423

Hey @thinkcloud 

 

They said:

---

 

Couple of issues:

Scott | Developer Advocate @ Shopify 

thinkcloud
Shopify Partner
8 0 0

Thanks, and how to retreive MediaImage with REST API ?
I only GET ProductImage 😕

SBD_
Shopify Staff
1831 273 423

This is an accepted solution.

Hey @thinkcloud 

 

Unfortunately I think these are only accessible via the GraphQL API.

 

{
  products(first:10) {
		nodes {
			id
			media(first:10) {
				nodes {
					id
				}
			}
		}
	}
}

Scott | Developer Advocate @ Shopify