Posting a product using Rest

Solved
Highlighted
Excursionist
20 2 1

I'm using Postman to make API requests using the REST reference (link) and I'm stuck on how to post a product.

 

I've managed to get products.

 

I used the same admin api credentials as with my GET request for my POST request:

 

https://{{API key}}:{{password}}@{{store-name}}.myshopify.com/admin/api/2020-01/products.json

With body from docs:

 

{
  "product": {
    "title": "Burton Custom Freestyle 151",
    "body_html": "<strong>Good snowboard!</strong>",
    "vendor": "Burton",
    "product_type": "Snowboard",
    "tags": [
      "Barnes & Noble",
      "John's Fav"
    ]
  }
}

I get a HTML response I don't understand.

 

Attempting the solution in another thread, I've tried to add a X-Shopify-Access-Token key to the request header but I'm not sure what credential to put there (I've tried my storefront access token) and haven't got it to work.

 

Any help will be much appreciated. 

 

 

0 Likes
Highlighted

Success.

Excursionist
20 2 1

UPDATE.

 

I made a successful POST request in the following format:

 

https://{site-name}.myshopify.com/admin/api/2020-01/products.json

with header 'X-Shopify-Access-Token' and value of the password from the Admin API.

0 Likes