Child Relationships
POST
Create Child Category Relationships
https://api.moltin.com/v2/categories/:categoryId/relationships/children
Create a relationship to a parent Category. If any relationship(s) already exists, new ones are added.
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
categoryId | Required | string | The ID of the category that you want to update relationships to. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token used to access the API. |
Body:
Name | Required | Type | Description |
---|---|---|---|
data[].type | Required | string | The type of related object. Ensure it is category . |
data[].id | Required | string | The ID of the parent category. |
200 OK
{
"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"
}
]
}'
PUT
Update Child Category Relationship
https://api.moltin.com/v2/categories/:categoryId/relationships/children
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
categoryId | Required | string | The ID of the category that you want to update relationships to. |
Body:
Name | Required | Type | Description |
---|---|---|---|
data[].type | Required | string | The type of related object. Ensure it is category . |
data[].id | Required | string | The ID of the parent category. |
200 OK
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
Delete Child Category Relationship
https://api.moltin.com/v2/categories/:categoryId/relationships/parent
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
categoryId | Required | string | The ID of the category that you want to update relationships to. |
Body:
Name | Required | Type | Description |
---|---|---|---|
data[].type | Required | string | The type of related object. Ensure it is category . |
data[].id | Required | string | The ID of the parent category. |
200 OK
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"
}]
}'