1.7 KiB
1.7 KiB
PUT /article/{sku}/children
Protected. Requires a valid session cookie (credentials: 'include').
Attach an existing article as a child to a parent article
Attaches an existing article to this parent article. Idempotent if already a child. Returns 409 if the article already belongs to another parent.
Path parameters
| Param | Required | Type | Description |
|---|---|---|---|
sku |
yes | string | Parent article SKU |
Body (JSON)
| Field | Required | Type | Description |
|---|---|---|---|
sku |
yes | string | SKU of the existing article to attach as child |
attributeValueId |
no | integer | ID of existing attribute value for the parent's attribute |
value |
no | string | String value to find or create under the parent's attribute |
reparent |
no | boolean | Whether to allow re-parenting if child already belongs to another parent |
{
"sku": "…",
"attributeValueId": 1,
"value": "…",
"reparent": true
}
Response 200
Attached child article and list of children
{
"article": {
"id": 1,
"categoryId": 1,
"name": "…",
"sku": "…",
"track_stock": true
},
"children": [
{
"id": 1,
"sku": "…",
"name": "…",
"parentsort": 1,
"attributeValueId": 1,
"attributeValue": "…"
}
]
}
Errors
| Status | Description |
|---|---|
| 400 | Missing sku or attribute value, or invalid input |
| 404 | Parent or child article not found |
| 409 | Article already belongs to another parent, or variant value already exists |
Generated from @openapi JSDoc. Do not edit by hand — run npm run docs:api.