V1 and V2Products (V2 beta)

Create a product

POST
/api/v2/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 id of the new product will be included in the response.

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/v2/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 this body:

{    "data": [        {            "id": "5bfad5ca5b84b100017a8f5a",            "created": "2018-11-25T17:03:06.596000+00:00",            "modified": "2018-11-25T17:03:06.628000+00:00",            "created_user_audit": {                "type": "API",                "user_email": "api",                "user_id": "67191ed7d6e8e300016f1414",                "user_name": "api"            },            "modified_user_audit": {                "type": "API",                "user_email": "api",                "user_id": "67191ed7d6e8e300016f1414",                "user_name": "api"            }        }    ]}

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

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

curl -X POST 'https://example.com/api/v2/products' \  -H 'Content-Type: application/json' \  --data-raw '{  "product_data": "your_product_data"}'
{  "data": [    {      "id": "5c4ef3a9bedb5e000189befc",      "created": "2019-01-28T12:20:57.341000+00:00",      "modified": "2019-01-28T12:20:57.437000+00:00",      "created_user_audit": {        "type": "API",        "user_email": "api",        "user_id": "67191ed7d6e8e300016f1414",        "user_name": "api"      },      "modified_user_audit": {        "type": "API",        "user_email": "api",        "user_id": "67191ed7d6e8e300016f1414",        "user_name": "api"      }    }  ]}