What's your biggest current challenge? Have your say in Community Polls along the right column.
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

400 Bad Request create new product

400 Bad Request create new product

lpdrop
Shopify Partner
1 0 1

Hello,

I'm trying to add a new product to my store through a Bubble application, I'm getting a 400 bad request when the body_html contains images,

My headers is

Content-Type - application/json

The body that is returning the error is simple... just an image

<img alt="" src="https://cdn.shopify.com/s/files/1/0568/8875/4330/files/Copia_de_Template_-_Meias_de_Compressao_-_Lan...">

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 525

Hi @lpdrop 👋

 

For issues with the Bubble application, it may be worthwhile to connect with them directly. Alternatively, you can create the product with the html image body using the below Shopify Admin GraphQL API curl request:

 

curl -L -X POST 'https://YOUR_STORE.com/admin/api/2023-01/graphql.json' \
-H 'X-Shopify-Access-Token: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
--data-raw '{"query":"mutation productCreate($input: ProductInput!) {\n productCreate(input: $input) {\n product {\n id\n title\n bodyHtml\n }\n }\n}\n","variables":{"input":{"title":"test product","bodyHtml":"<img alt=\"\" src=\"https://cdn.shopify.com/s/files/1/0568/8875/4330/files/Copia_de_Template_-_Meias_de_Compressao_-_Landing_Page_1.png?v=1660678254\">"}}}'

 

Hope that helps!

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog