Re: Product POST Method is returning status 200 but don't create a product

Product POST Method is returning status 200 but don't create a product

caesar_imperium
Shopify Partner
2 0 3

Hi everyone, how are going? I'm trying to create a product using the POST request method, but every time I send a request I receive a status 200, but the product that I sent wasn't created. I already created an authentication token and all routes (DELETE, GET, PUT) except POST are working. I tried to force an error by sending a product without a title, but I have the response status 200. 


I searched and saw that the cookies could be the problem, but I cleaned all my cookies in insomnia and I am having the same problem.

I really don't know what I can do to continue with my script. Someone already faced this kind of problem and could help me? Thanks

Replies 6 (6)

Quizque
Shopify Partner
2 0 0

Having the same issue on only some sites. Seems to work fine on admin keys that are over a week old but not on any recently made keys. Always seems to just return code 200 and some other stuff with it but never successfully POSTs.

Quizque
Shopify Partner
2 0 0

After some experimenting, you need to send the POST request to https://{site}.myshopify.com and not to the custom domain if that's what is being used. Solved my issue right away.

caesar_imperium
Shopify Partner
2 0 3

Yeah, I'm sending to this path -> https://{nameOfMyDomain}.myshopify.com/admin/api/2023-07/products.json
However, the information that I'm passing by body in a POST request:

{
  "product": {
    "title": "Burton Custom Freestyle 151",
    "body_html": "<strong>Good snowboard!</strong>",
    "vendor": "Burton",
    "product_type": "Snowboard",
    "variants": [
      { "option1": "First", "price": "10.00", "sku": "123" },
      { "option1": "Second", "price": "20.00", "sku": "123" }
    ]
  }
}

it's not being added... It's quite fuzzy cuz I'm receiving 200 status code and all the products are being returned too. (It'll return 200 even when I don't send any body)

caesar_imperium_0-1695526170176.png

Empty body ⬇️

caesar_imperium_1-1695526261738.png

 

Kajal-Caelius
Shopify Partner
1 0 0

I'm also facing the same error any solutions to this problem. 

 

Tracker7265
Visitor
1 0 0

did you find a solution for this?

Mitanshu-CCI
Visitor
1 0 1

Facing the same issue.
If someone finds a solution please email
Your efforts will be appreciated.
Thanks!