Category Relationship

Create Category Relationship(s)

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

Create a Product relationship to on or more Categories. If any relationships already exist, the one's made in the request will be added to them.

Path Parameters

NameTypeDescription

productId

string

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

Headers

NameTypeDescription

Authorization

string

The Bearer used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be category).

data[].id

string

The ID of the category.

{
    "data": [
        {
            "type": "category",
            "id": "39a13b7e-f2d3-47a5-9bc5-1e98b198748c"
        },
        {
          "type": "category",
          "id": "0c108707-bb4a-4eda-95e3-f51b35122cb4"
        }
    ]
}
curl -X "POST" https://api.moltin.com/v2/products/:productId/relationships/categories \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "category",
          "id": "39a13b7e-f2d3-47a5-9bc5-1e98b198748c"
        },
        {
          "type": "category",
          "id": "0c108707-bb4a-4eda-95e3-f51b35122cb4"
        }
      ]
    }'

Update Category Relationship(s)

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

Replace the relationships between a Product and a Category. 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 category(s).

Headers

NameTypeDescription

Authorization

string

The Bearer used to access the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of objects (should be category).

data[].id

string

The ID of the category.

{
    "data": [
        {
            "type": "category",
            "id": "d7290481-8d03-4fe0-a7df-23fc05498a46"
        }
    ]
}
curl -X "PUT" https://api.moltin.com/v2/products/:productId/relationships/categories \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "category",
          "id": "d7290481-8d03-4fe0-a7df-23fc05498a46"
        }
      ]
    }'

Delete Category Relationship(s)

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

Removing a relationships between a Product and Category(s) deletes the relationships specified in the payload.

Path Parameters

NameTypeDescription

productId

string

The ID of the product you wish to delete.

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 category).

data[].id

string

The ID of the category.

curl -X "DELETE" https://api.moltin.com/v2/products/:productId/relationships/categories \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "category",
          "id": "0c108707-bb4a-4eda-95e3-f51b35122cb4"
        }
      ]
    }'

Last updated