A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
We can't seem to find the product image urls from the Shopify APIs. It is not in the following tables: product, product_variant or product_option, and it is not listed in the Abandoned Basket API. Where can it be found?
Solved! Go to the solution
This is an accepted solution.
REST - The src property, aka Source, specifies the location of the product image for a Product Image
Product resource > Images property - https://shopify.dev/api/admin/rest/reference/products/product
Get a Product /admin/api/2021-07/products/{product_id}.json
Product Image(s) are also their own stand alone resource(s)
Get all images on a product /admin/api/2021-07/products/{product_id}/images.json
Get a specific Image using the ProductImage ID - /admin/api/2021-07/products/{product_id}/images/{image_id}.json
Retrieve only particular fields from a single product I.E. https://shopify.com/admin/products/123.json?fields=id,images,title :
{
"product": {
"images": [
{
"id": 1234,
"product_id": 123,
"position": 1,
"created_at": "2020-06-23T14:14:53-04:00",
"updated_at": "2020-06-23T14:14:53-04:00",
"alt": null,
"width": 1024,
"height": 1024,
"src": "https://cdn.shopify.com/s/files/1/1234/1234/products/file-name_1024x_<36characterhash>.jpg?v=1",
"variant_ids": [
],
"admin_graphql_api_id": "gid://shopify/ProductImage/123"
}
]
}
}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
This is an accepted solution.
REST - The src property, aka Source, specifies the location of the product image for a Product Image
Product resource > Images property - https://shopify.dev/api/admin/rest/reference/products/product
Get a Product /admin/api/2021-07/products/{product_id}.json
Product Image(s) are also their own stand alone resource(s)
Get all images on a product /admin/api/2021-07/products/{product_id}/images.json
Get a specific Image using the ProductImage ID - /admin/api/2021-07/products/{product_id}/images/{image_id}.json
Retrieve only particular fields from a single product I.E. https://shopify.com/admin/products/123.json?fields=id,images,title :
{
"product": {
"images": [
{
"id": 1234,
"product_id": 123,
"position": 1,
"created_at": "2020-06-23T14:14:53-04:00",
"updated_at": "2020-06-23T14:14:53-04:00",
"alt": null,
"width": 1024,
"height": 1024,
"src": "https://cdn.shopify.com/s/files/1/1234/1234/products/file-name_1024x_<36characterhash>.jpg?v=1",
"variant_ids": [
],
"admin_graphql_api_id": "gid://shopify/ProductImage/123"
}
]
}
}
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Thanks so much Paul for your help!
GraphQL - Image - https://shopify.dev/api/admin/graphql/reference/common-objects/image
{
products(first:1,query:"id:4596216102958"){
edges {
node {
featuredImage {
id
}
# current max images on a product is 250
images(first:250) {
edges {
node {
id
originalSrc
transformedSrc
}
}
}
}
}
}
}
Note there are also the objects: Media , MediaImage and MediaPreviewImage . Review https://shopify.dev/api/admin/graphql/reference/products-and-collections
Contact paull.newton+shopifyforum@gmail.com for the solutions you need
Save time & money ,Ask Questions The Smart Way
Problem Solved? ✔Accept and Like solutions to help future merchants
Answers powered by coffee Thank Paul with a ☕ Coffee for more answers or donate to eff.org
Hi Paul,
thanks for showing how this is done in REST and GraphQL.
Sadly the 2021-10 version of the GraphQL API doesn't support the src and url fields anymore. I couldn't find any possible way to get the URL of an image.
I have code copying collections with all their fields. This doesn't seem to work anymore. It looks like, I have to upload the image every time now.
Or do I miss something?
I am seeing this with 2021-10, too, although `src` is deprecated, it says to use `url` instead, but `url` is not available yet. src still works for now, however.