Working on a nice little app that needs to upload quite a few (rather small) images to the main theme of a Shopify store.
1. Have all the images present in my assets directory on the back-end side of my app (Node.js using Koa and Koa Router)
2. Have a route (i.e. a Koa route) that has the access token required to call the API
3. Run a loop that uploads all files once to the current theme using the endpoints specified in https://help.shopify.com/en/api/reference/online-store/asset
This is a rather slow operation if we're talking about hundreds of assets (even if they're rather small), and it's blocking since I need all assets to be available to my front-end (I'm generating liquid on-the-fly using asset URLs that are created by the asset upload).
Is there some way to bulk upload all images in one piece, without downloading the theme, editing it and re-uploading it?
Unfortunately, there is currently no way to bulk upload assets via the API.
It seems like your application is currently downloading, modifying, and re-uploading the entire theme for each image, which as you have mentioned, is a very arduous operation. Although it is still not optimal, if you are aware of the theme templates that you are updating, it could potentially be faster to simply update these templates individually since you are able to specify the asset that needs to be updated and provide an
src to specify the image that needs to be uploaded to Shopify. This is documented here: https://help.shopify.com/en/api/reference/online-store/asset#update-2019-10
Hey @sd_ ,
Thanks for the response.
I'm afraid I have no clue as to which theme will be used by my customers, so the src approach might not work here.
Thanks for the heads up on the idea though!
|8 hours ago|