A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi!
I'm building a private app that will have the ability to create products on the store. I understand that using GraphQL, I have to provide a URL to the product as opposed to being able to provide a base64 encoded "attachment" if using REST. I've seen it requested (and confirmed to be being worked on) that we be able to provide an attachment instead of a URL when using GraphQL, so that's not my question... my question is, is there a way to upload to the CDN instead of finding image hosting somewhere else, to then provide that URL for the product image? I rather not have my product images living somewhere else for the mere purpose of passing it along to the product during creation.
Thanks!
Solved! Go to the solution
This is an accepted solution.
You can use our Admin GraphQL API's StagedUploadTargetGenerate mutation to initialize a storage bucket with your image file, which returns to you a src URL you can use to add the image(s) to resources:
https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/stageduploadtargetgenerate
Hope that helps, it definitely appears to solve the issue of having to upload to another service. Let me know if you have any questions, or if I've misunderstood what you're looking for.
Cheers.
The answer above has been updated for accuracy on July 3rd, 2019
Alex | 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 the Shopify Help Center or the Shopify Blog
This is an accepted solution.
You can use our Admin GraphQL API's StagedUploadTargetGenerate mutation to initialize a storage bucket with your image file, which returns to you a src URL you can use to add the image(s) to resources:
https://help.shopify.com/en/api/graphql-admin-api/reference/mutation/stageduploadtargetgenerate
Hope that helps, it definitely appears to solve the issue of having to upload to another service. Let me know if you have any questions, or if I've misunderstood what you're looking for.
Cheers.
The answer above has been updated for accuracy on July 3rd, 2019
Alex | 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 the Shopify Help Center or the Shopify Blog
How to upload image to shopify and access via url ?
I want to upload with data image is base64 string. Thank !