V1 and V2Products (V2 beta)

Add products to a relationship

POST
/api/v2/products/{product_id}/relationships/{relationship_id}

Assign products to an existing relationship

Note: If the payload includes a product that doesn't exist or has already been added, it will be silently ignored. No error will be returned, as the system avoids extra processing to check for product validity.

A 200 OK status code is returned upon success

Request format

To assing a product to any relationship, the id of the product to be related along with its quantity must be provided.

fieldtypedescription
product_relationshipsArray of objectslist with product and quantities

A product_relationship object is defined by:

fieldtypedescription
product_idstringproduct identifier
quantitynumberrelationship quantity

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

Path Parameters

product_id*string
relationship_id*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

curl -X POST 'https://example.com/api/v2/products/string/relationships/string' \  -H 'Content-Type: application/json' \  --data-raw '{  "product_relationships": [    {      "quantity": 1,      "product_id": "5d0baf07d4bf5513d190245f"    },    {      "quantity": 9,      "product_id": "5d0baf07d4bf5513d1902460"    },    {      "quantity": 6,      "product_id": "5d0baf07d4bf5513d1902461"    },    {      "quantity": 1,      "product_id": "5d0baf07d4bf5513d1902462"    }  ]}'
Empty