Collection Relationships

Create Collection Relationship(s)

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

Create a product relationship to one or many Collections. 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 collection(s).

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be collection).

data[].id

string

The ID of the collection.

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

Update Collection Relationship(s)

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

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

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be collection).

data[].id

string

The ID of the collection.

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

Delete Collection Relationship(s)

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

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

Path Parameters

NameTypeDescription

productId

string

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

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API.

Request Body

NameTypeDescription

data[].type

string

Represents the type of object (should be collection).

data[].id

string

The ID of the collection.

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

Last updated