I am developing a tool that migrates blog post via Articles API.
HTML content I migrate of course have many <img src=""> tags. Is there a way I could force Arciles API to upload those images to shopify and replace a image path to cdn.shopify.com?
Or there is any other way of implementing it? As far as I know there is no FIles API I can use.
You can use the articles API to associate an image to an article or blog post, but not to upload them to Shopify. If the image is a product image, you can upload it to the product first, and then associate it to the blog. Otherwise hosting elsewhere and linking to the article is a good solution.
I wanted to do the same thing so I created a blog called 'Images' and every time I needed to place an image in a blog I created an empty blog post in 'Images' with the image as the feature image, this works since the Article API (scroll to 'Create an article with a base64 encoded image') will allow you to create one feature image for a blog, I then used the returned feature image src in my real blog post.
I guess you could then go and delete the 'Image' blog posts or periodically delete them and I assume (but not certain) that the files would not be removed.
Another good idea would be to create a blog template for images which returns 404.
This does achieve the same end goal but it would be much better if there was a Files API to make this process a lot simpler.
Hope this helps someone,