Variations Relationship

Create Variations Relationship(s)

POST https://api.moltin.com/v2/products/:productId/relationships/variations

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to relate to the variation(s).

Headers

NameTypeDescription

Authorization

string

The Bearer token used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be product-variation).

data[].id

string

The ID of the product-variation.

{
    "data": [
        {
            "type": "product-variation",
            "id": "3ab3deca-1f11-47b7-a409-24ea3234d72c"
        },
        {
          "type": "product-variation",
          "id": "7c740aa0-7fb7-4bd6-9347-78988cf60f9a"
        }
    ]
}
curl -X POST https://api.moltin.com/v2/products/:productId/relationships/variations \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "product-variation",
          "id": "3ab3deca-1f11-47b7-a409-24ea3234d72c"
        },
        {
          "type": "product-variation",
          "id": "7c740aa0-7fb7-4bd6-9347-78988cf60f9a"
        }
      ]
    }'

Update Variation Relationship(s)

PUT https://api.moltin.com/v2/products/:productId/relationships/variations

Replace the relationships between a product and a variation. Unlike a POST to this endpoint, a PUT overrides any existing relationships.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to relate to the variation(s).

Headers

NameTypeDescription

Authorization

string

The Bearer token used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be product-variation).

data[].id

string

The ID of the variation.

{
    "data": [
        {
            "type": "product-variation",
            "id": "2c740aa0-7fb7-4bd6-9347-78988cf60f9a"
        }
    ]
}
url -X PUT https://api.moltin.com/v2/products/:productId/relationships/variations \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "product-variation",
          "id": "2c740aa0-7fb7-4bd6-9347-78988cf60f9a"
        }
      ]
    }'

Delete Variation Relationship(s)

DELETE https://api.moltin.com/v2/products/:productId/relationships/variations

Remove a relationship between a Product and a Variation(s). This deletes the relationships specified in the payload.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to relate to the variations(s)

Headers

NameTypeDescription

Authorization

string

The Bearer token used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be product-variation).

data[].id

string

The ID of the variation.

curl -X DELETE https://api.moltin.com/v2/products/:productId/relationships/variations \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "product-variation",
          "id": "2c740aa0-7fb7-4bd6-9347-78988cf60f9a"
        }
      ]
    }'

Last updated