Files
2026-10-20 23:21:48 +02:00

58 lines
1.8 KiB
Markdown

# `POST /article/{sku}/parent`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Toggle parent mode for an article
Enables or disables parent article status. Enabling requires specifying an
attributeNameId; disabling requires the article to have zero children.
`attributeNameId` is **conditionally required**: it is optional in the schema
because it is only required when `isParent` is `true`. Omitting it (or passing
`0`/a negative value) together with `isParent: true` returns `400`
`attributeNameId is required to become a parent article`. It must not be sent
when `isParent` is `false`.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `isParent` | yes | boolean | True to make article a parent, false to revert to regular article |
| `attributeNameId` | no | integer | **Conditionally required when `isParent` is `true`** (required iff isParent=true). The attributename id used for the article's variants. Omitting it while enabling parent mode returns 400. Must be omitted when `isParent` is `false`. |
```json
{
"isParent": true,
"attributeNameId": 1
}
```
## Response `204`
Updated
_No content_
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input — `attributeNameId` missing while `isParent` is true, article still
has children (disabling), or the attribute is already used by an ancestor parent.
|
| 404 | Article or attribute name not found |
| 409 | Article state conflicts with becoming a variant parent — it still has stock,
assigned suppliers, a Stückliste, or options. Clear these first.
|
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._