Child Relationships

Create Child Category Relationships

POST https://api.moltin.com/v2/categories/:categoryId/relationships/children

Create a relationship to a parent Category. If any relationship(s) already exists, new ones will be added.

Path Parameters

NameTypeDescription

categoryId

string

The ID of the category you wish to make relationships to

Headers

NameTypeDescription

Authorization

string

The Bearer token used to access the API

Request Body

NameTypeDescription

type

string

The type of related object (should be be category)

id

string

The ID of the parent category

{
    "data": {
        "id": "59a8c4e2-bd2d-4a14-9f1a-a497330cdf11",
        "type": "category",
        "status": "live",
        "name": "Mens",
        "slug": "mens",
        "description": "Browse our mens clothing line",
        "meta": {
            "timestamps": {
                "created_at": "2019-07-04T13:18:53+00:00",
                "updated_at": "2019-07-04T13:18:53+00:00"
            }
        },
        "relationships": {}
    }
}
curl -X POST https://api.moltin.com/v2/categories/:categoryId/relationships/children \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "category",
          "id": "8a43aea7-79f0-4bcf-9bc8-a0f5d3d3642c"
        }
      ]
    }'

Update Child Category Relationship

PUT https://api.moltin.com/v2/categories/:categoryId/relationships/children

Path Parameters

NameTypeDescription

categoryId

string

The ID of the category you wish to make relationships to

Request Body

NameTypeDescription

type

string

The type of related object (should be category)

id

string

The ID of the parent category

curl -X PUT https://api.moltin.com/v2/categories/:categoryId/relationships/children \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
      "data": [
        {
          "type": "category",
          "id": "c902aea9-ec90-4fdd-8084-3c2d879a2c52"
        }
      ]
    }'

Delete Child Category Relationship

DELETE https://api.moltin.com/v2/categories/:categoryId/relationships/parent

Path Parameters

NameTypeDescription

categoryId

string

The ID of the category you wish to update relationships to.

Request Body

NameTypeDescription

data

object

data[].type

string

The type of related object. (should be category)

data[].id

string

The ID of the child category

curl -X DELETE https://api.moltin.com/v2/categories/:categoryId/relationships/parent \
     -H "Authorization: Bearer XXXX" \
     -d $'{
       "data": [{
         "type": "category",
         "id": "c902aea9-ec90-4fdd-8084-3c2d879a2c52"
        }]
      }'

Last updated