Hello, I’m fairly new to Shopify and also approaching this from a nocode perspective, utilizing Bubble.io and its API connector to achieve my desired results.
Simply, I want to upload an image to a particular product.
This is the call that I’m tying to use, as located on https://shopify.dev/docs/admin-api/rest/reference/products/product-image#create-2021-04
Inside Bubble I have the following set up:
You can see that I’m passing in dynamic data, and that I’m following the body as it is displayed in the guide.
However, when I initialize the call I’m met with the following:
I’ve been able to authenticate, GET products and GET scopes, but my POST function is not working.
Is there something that I should be doing in particular? Thanks!
Hello @CameronB2
As per the document you need to pass the image(base64) and file name.
The other option is you need to pass the URL from where Shopify can able to grab the image, you can upload it on your server and provided a URL
Based on reviewing your screenshot, you are passing binary source as SRC which not allowed and accepted.
Hey Rahul, thanks for the input.
I’ve converted my image to the base64 and have since tried the call. Now the error message is an internal 500 error.
You also said that it appears I’m using a binary source for my image upload using the second example.
The URL I am using is from an s3 server. In fact, the specific URL I’m using is https://s3.amazonaws.com/appforest_uf/f1622776263342x139124475827094860/003.jpg
I also uploaded the image to Shopify. I took the link provided, hosted on the Shopify CDN server and I received the same result.
If that is considered a binary source, how would I make it to where it’s not?
Thanks!
Hello @CameronB2
I just use same API in my store with the URL method
I am using postman as API client
Hope you are using the API key and Password from the Private App section( {yourstoreurl}/admin/apps/private) https://shopify.dev/docs/admin-api
Generate API key: https://shopify.dev/tutorials/generate-api-credentials
I think one of the main differences here is that the application I’m using/creating is not a private app, but a custom application.
I wasn’t aware that this prevented certain functionality from working.
Say that I want to continue to use a custom app – is there anyway that I can execute this call? Or am I restricted to a private app?
Further, I have already created an API key using the Shopify Partners page and completed the redirect uri’s, etc.
@CameronB2
Custom APP is another way for development agencies to provide custom app services to merchants, but if you are the store owner and only using it for your store then the private app will be easy navigation for you to update data on your store.
Understood.
Unfortunately after testing with a private app (ensuring that my other calls would work, which they do), the POST for the product image is still giving me the same error. Darn. Really frustrating, I must be doing something wrong.
I was able to revisit this and determined that while my content was the same, the way my body was formatted was incorrect.
Instead of it being automatically detected as json, I had to switch my body to raw, and then inside the headers I had to specify the content type. Now, fortunately, it works.
Thank you!