Files
dashback/docs/api/routes/article/_sku/children.post.md
2026-10-01 10:19:16 +02:00

58 lines
1.3 KiB
Markdown

# `POST /article/{sku}/children`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Add a child article to a father article
Automatically generates SKU as fatherSku-nextFreeIndex (or accepts custom sku) and assigns the variant attribute.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Father article SKU |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `attributeValueId` | no | integer | ID of existing attribute value for the father's attribute |
| `value` | no | string | String value to find or create under the father's attribute |
| `name` | no | string | Optional custom variant name |
| `sku` | no | string | Optional custom SKU for the child article |
```json
{
"attributeValueId": 1,
"value": "…",
"name": "…",
"sku": "…"
}
```
## Response `201`
Created child article
```json
{
"article": {
"id": 1,
"categoryId": 1,
"name": "…",
"sku": "…",
"track_stock": true
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Father not configured as father, missing value, duplicate variant, or child SKU already exists |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._