V1 and V2Products (V1)

Create a product

POST
/api/v1/products

Creates a product

There's only a mandatory parameter, sku of the product. Readonly and unknown parameters will be
ignored from request data.

Note: This method does not allow the creation of new attributes, categories or assets.

ParameterTypeMandatory
skustringyes

Custom product attributes are located under “attributes” parameter. Thumbnail, assets, categories, media and media galleries
can be linked to a product.

Upon successful creation, a 201 http status code will be returned, the new product
will be in the response body of the request and it resource identifier could be found
in response headers.

Thumbnail, assets and media attribute linking

You are not allowed to upload any new assets to your PIM account using this resource, thats Asset's endpoint business, but
you are allowed to link existing assets into your product.
To link an existing asset to any of this kind of attribute, only asset identifier is mandatory

Media gallery

Media gallery contains a collection of medias, so in this case you need to indicate an array of asset objects.
All constraints described in asset linking section apply.

Categories linking

All constrains described in asset linking section apply to categories. Only id of the category is mandatory.

Example 1. Product creation

POST /api/v1/products/

{   "sku": "blue adventure mug S023",   "label": "Adventure mug",   "attributes" : {          "stock" : 123,          "vendor_url": "http://acme.com",          "since": "2015-03-28",          "Media_gallery":[                {"id":"5bfaced551e7590001486763"},                {"id":"5bfaced551e7590001486765"}          ],            "media_single_1": {"id":"5bfaced551e7590001486764"}      },    "categories": [           {               "id": "5bfa91ab8544120001bd9078"           }    ]}

A successful request returns 201 CREATED, with a Location header holding the new product's URL, such as https://pim.plytix.com/api/v1/products/5bfad5ca5b84b100017a8f5a, and this body:

{    "data": [        {            "assets": [],            "attributes": {              "since": "2015-03-28",              "stock" : "123",              "vendor_url": "http://acme.com",              "media_gallery": [                    {                        "filename": "1.jpeg",                        "id": "5bfaced551e7590001486763",                        "thumb": "https://files.plytix.com/api/v1.0/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/1.jpeg",                        "url": "https://files.plytix.com/api/v1.0/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486763/1.jpeg"                    },                    {                        "filename": "3.jpeg",                        "id": "5bfaced551e7590001486765",                        "thumb": "https://files.plytix.com/api/v1.0/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486765/3.jpeg",                        "url": "https://files.plytix.com/api/v1.0/file/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486765/3.jpeg"                    }                ],                "media_single_1": {                    "filename": "2.jpeg",                    "id": "5bfaced551e7590001486764",                    "path": "assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486764/2.jpeg",                    "thumb": "https://files.plytix.com/api/v1.0/thumb/public_files/pim/assets/d1/6d/8e/5b/5b8e6dd17f7f46000c7e9629/images/d5/ce/fa/5b/5bfaced551e7590001486764/2.jpeg"                }            },            "categories": [                   {                       "id": "5bfa91ab8544120001bd9078",                       "name" : "Mugs",                       "path": [ "Mugs" , "Ceramic"  ]                   }            ],            "id": "5bfad5ca5b84b100017a8f5a",            "created": "2018-11-25T17:03:06.596000+00:00",            "modified": "2018-11-25T17:03:06.628000+00:00",            "sku": " blue adventure mug S023",            "label": "Adventure mug",            "status": "Draft",            "num_variations": 0,            "thumbnail": null,            "assets": [ { "id":"..." }, { "id":"..." }]        }    ]}

Authorization

bearerAuth
AuthorizationBearer <token>

Obtain a token via POST /auth/api/get-token (15 minute lifetime), then send it as Authorization: Bearer <token>.

In: header

Response Body

application/json

application/json

application/json

curl -X POST 'https://example.com/api/v1/products'
{  "data": [    {      "_parent_id": null,      "assets": [],      "attributes": {        "color_create_a_multiselect_type_attribute": [          "Blue"        ],        "description_create_a_rich_text_type_attribute": "Try making the description a <b>Rich Text</b> attribute so that you can format the text however you'd like."      },      "categories": [        {          "id": "5c4ed7f62f0985001c233276",          "name": "Ground Coffee",          "path": [            "Sample Categories",            "Coffee & Tea",            "Ground Coffee"          ]        },        {          "id": "5c4ed7f62f0985001c233278",          "name": "Drinkware",          "path": [            "Sample Categories",            "Drinkware"          ]        },        {          "id": "5c4ed7f62f0985001c233279",          "name": "Kettles & Teapots",          "path": [            "Sample Categories",            "Kettles & Teapots"          ]        }      ],      "created": "2019-01-28T12:20:57.341000+00:00",      "id": "5c4ef3a9bedb5e000189befc",      "label": "Black Kettle",      "modified": "2019-01-28T12:20:57.437000+00:00",      "num_variations": 0,      "sku": "Black Kettle_1111",      "status": "Completed",      "thumbnail": null    }  ]}