63 lines
1.6 KiB
Markdown
63 lines
1.6 KiB
Markdown
# `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 |
|
|
|
|
```json
|
|
{
|
|
"sku": "…",
|
|
"attributeValueId": 1,
|
|
"value": "…",
|
|
"reparent": true
|
|
}
|
|
```
|
|
|
|
## Response `200`
|
|
|
|
List of children after attaching
|
|
|
|
```json
|
|
{
|
|
"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`._
|