Category Relationships

Create Category Relationship

POST https://api.moltin.com/v2/categories/:id/relationships/categories

Path Parameters

NameTypeDescription

id

string

The ID of the Category you want to modify relationships for

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

Request Body

NameTypeDescription

parent.type

string

The type of the related object (should be category)

parent.id

string

The ID of the parent Category

children[].type

string

The type of related object (should be category)

children[].id

string

The ID of the Category

{
    "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-04T14:29:45+00:00"
        }
    },
    "relationships": {}
}
curl -X POST https://api.moltin.com/v2/categories/:id/relationships/categories \
     -H "Authorization: Bearer XXXX" \
     -H "Content-Type: application/json" \
     -d $'{
        "data": {
            "parent": {
                "type": "category",
                "id": "6272a049-dc98-428b-ad90-65572add46c0"
            },
            "children": [
                {
                "type": "category",
                "id": "b438be03-9ae7-4e6a-8fb6-7ee41ce0ae71"
                }
            ]
        }
    }'

Last updated