Can't get preview image for video

Highlighted
New Member
1 0 0

Hi, I'm trying to get preview image for video from Storefront API but receive "message": "Field 'preview' doesn't exist on type 'Media'", but according to Documentation
https://shopify.dev/docs/storefront-api/reference/object/media
https://shopify.dev/docs/storefront-api/reference/object/video
it should be in Media and Video and I can't get it from no one of them

my request
{
"query": "query { product: node (id: "....") { __typename,id,... on Product { id,title,createdAt,description,productType,publishedAt,tags,updatedAt,vendor,images (first: 250) { pageInfo { hasNextPage,hasPreviousPage },edges { cursor,node { src,id,altText } } },media (first: 10) { pageInfo { hasNextPage,hasPreviousPage },edges { cursor,node { mediaContentType,preview { image { src } },... on Video { sources { url,mimeType,format,height,width } } } } },variants (first: 250) { pageInfo { hasNextPage,hasPreviousPage },edges { cursor,node { id,product { id },title,price,image { src,id,altText } } } } } } }"
}

0 Likes
Highlighted
Shopify Staff
Shopify Staff
55 6 8

Hey @Alexy,

You're close! As listed in your first link, replace 'preview' with 'previewImage' e.g:

query {
  products(query: "..." first:10) {
     edges {
      node {
        media(first:10) { 
          edges {
            node {
              alt
              mediaContentType
              previewImage {
                originalSrc
              }
            }
          }
        }
      }
    }
  }
}

 

Callum | Developer Support @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes