I have been trying to figure out how to upload media for a few days. Now I have gotten uploading videos correctly, with the help of this tutorial - https://shopify.dev/tutorials/manage-product-media-with-admin-api. However, I cannot seem to push images up to Shopify.
1. Under https://shopify.dev/tutorials/manage-product-media-with-admin-api#upload-the-asset, if I were to do a POST request for an image, I am missing the policy attribute to add to my form. I've tried api versions 2020-01 and 2020-07, and the policy isn't returned in either the params of the url or parameters returned by the "stagedUploadsCreate" mutation.
I've also tried excluding the "nonexistent" attributes that are in the documentation (i.e. AWSAccessKeyId, policy, signature) and instead include all the parameters in the url but not in doc (e.g. x-amz-acl, X-Amz-Algorithm, X-Amz-Credential, X-Amz-Signature, etc.). In this case, an InternalError is thrown - "We encountered an internal error. Please try again".
2. For PUT requests, I have not found a way to mimic curl -T or --upload-file (as per example given in documentation) with axios.
Any help is appreciated, thanks.
Edit: I have tried both productCreateMedia (which works for videos) and productAppendImages mutations, and neither worked with images, so I'm assuming something went wrong in the uploading step.
Solved! Go to the solution
What ended up working for you.
I'm getting a 403 back from s3. I'm using the parameters returned by stageUploadsCreate which are:
Should I also be using the parameters that are in the url? I'm seeing these: