A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
How to get a file with its ID gid://shopify/MediaImage/XXX with an API query? This only works for product images, but I can't extract another image not assigned to products.
Hi Andrew,
What's the full query you're trying to run, and what image file format are the images that are not product images?
Liam | Developer Advocate @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hi,
Working now, just had to change permissions to write_files, read_files, read_products, read_themes, write_products
While there's no direct way to retrieve a file using its GID via a single API query, here are the workarounds you can use:
1. For Product Images:
2. For Non-Product Images:
a. Using the REST Admin API:
b. Using GraphQL (with potential limitations):
Key Considerations:
Additional Tips: