Bad request using Rest API Shopify (create product method POST)

Hi everyone,

I am facing an issue. I am trying to create a new product in Shopify, using a Make Request (HTTP module).
Before someone asks, i dont use the Shopify’s Built-App because the url domain does not end with “myshopify.com”.

Well here is the configuration of the HHTP Module (hope you will see the screenshot):

In the screenshot i use a Shopify test environment, but the issue is the same.

I ve tried in Postman and it works… (the header Host and Content-Length seem to be mandatory).

The RequestBody part is filled with a value and here is what 's in it :

image

it provides the following json string:

{“product”:{“title”:“Bracelet WHITE HEAVEN B-2426 Elya (SS24)”,“body_html”:“

Bracelets entièrement confectionnés à la main Composition : Perles de Miyuki dorées blanc nacré, et taupe Prix Unitaire=14€

”,“vendor”:“Belle mais pas que…”,“status”:“active”,“variants”:[{“price”:“14”, “sku”:“WHIH-B2426NU-SS24”, “inventory_policy”:“continue” } ]}}

Json string which i used in Postman.

For testing purpose i ve tried with the Shopify’s Built-in App, and it works. It’s driving me crazy. :stuck_out_tongue_winking_eye:

Anyone who has a solution will be blessed :innocent:

Many thks.

Baptiste.

Are you getting an error on your HTTP request? What’s the output bundle?

3 Likes

Well, I’m asking why not?

From your screenshots you are using “dev-all-clients-test.shopify.com” - a subdomain of shopify.com

You have the option of entering a subdomain when creating a connection, even if you are developing a custom app for Shopify.

So your X-Shopify-Access-Token simply goes into the “Admin API Access Token” field, and now you can just use the Shopify integration instead of manually creating the HTTP request.

2 Likes

Hi Alex,

No output bundle was produced, here is a screenshot of the Error 400

The Headers section only contains the Shopify Access Token.

Regards.

Hi Sam,

As I said, i ve tested with the Shopify built-in app (and it works fine), but i cant use it. I am using a test environment (which has a “.shopify.com” subdomain) to develop and test my scenario.

My customer has a shop with an address like that : mybrandname.pro. The built-in app does not deal with such address.

Regards.

Hi all,

I ve found my issue (thanks to the dev tool integromat chrome extension).
One mandatory parameter for the body request was missing (but it was not mentionned as mandatory in the REST admin reference).

Many thks for your answers.
Regards.
Baptiste.

2 Likes

Hey there @Baptiste_Petrilli :wave:

Wow! So impressive that you were able to figure this out! :clap:

Also thank you very much for providing us the solution. This way we keep our community organized and easy to look for solutions.

Keep up the awesome work! :cat_roomba:

1 Like

Yeah a 400 error usually means something is wrong in the body of the request. Glad you were able to figure it out!

3 Likes

Hi Sam,
In fact it was a good thing you ask why not :wink:

I ve discovered, that even if the front domain of a shopify website does not match mysite.myshopify.com, in fact its always has an address like this. There are some redirections to the Shopify hosted website. Ive found that when testing request in Postman, and in the headers response, the link parameter gives the website address with the .myshopify.com domain.

I was an idiot to think some people have developped the Shopify built-in app, and that we cannot use it every time we ll have to deal with Shopify.

Thks again for asking why not ?

Regards.
Baptiste.

2 Likes

Thks Alex for your help.

Regards.

1 Like