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

caesar_imperium
Shopify Partner
2 0 2

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 3 (3)

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 2

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