u
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Add a child article to a father article
|
||||
Create and attach a new child article to a father article
|
||||
|
||||
Automatically generates SKU as fatherSku-nextFreeIndex (or accepts custom sku) and assigns the variant attribute.
|
||||
Automatically generates SKU as fatherSku-nextFreeIndex and name from father name + value. Rejects a caller-supplied sku.
|
||||
|
||||
## Path parameters
|
||||
|
||||
@@ -19,14 +19,12 @@ Automatically generates SKU as fatherSku-nextFreeIndex (or accepts custom sku) a
|
||||
| `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": "…"
|
||||
"name": "…"
|
||||
}
|
||||
```
|
||||
|
||||
@@ -50,7 +48,7 @@ Created child article
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Father not configured as father, missing value, duplicate variant, or child SKU already exists |
|
||||
| 400 | Father not configured as father, missing value, duplicate variant, or sku was provided in body |
|
||||
|
||||
---
|
||||
|
||||
|
||||
62
docs/api/routes/article/_sku/children.put.md
Normal file
62
docs/api/routes/article/_sku/children.put.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# `PUT /article/{sku}/children`
|
||||
|
||||
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
||||
|
||||
Attach an existing article as a child to a father article
|
||||
|
||||
Attaches an existing article to this father article. Idempotent if already a child. Returns 409 if the article already belongs to another father.
|
||||
|
||||
## Path parameters
|
||||
|
||||
| Param | Required | Type | Description |
|
||||
|-------|----------|------|-------------|
|
||||
| `sku` | yes | string | Father 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 father's attribute |
|
||||
| `value` | no | string | String value to find or create under the father's attribute |
|
||||
| `reparent` | no | boolean | Whether to allow re-parenting if child already belongs to another father |
|
||||
|
||||
```json
|
||||
{
|
||||
"sku": "…",
|
||||
"attributeValueId": 1,
|
||||
"value": "…",
|
||||
"reparent": true
|
||||
}
|
||||
```
|
||||
|
||||
## Response `200`
|
||||
|
||||
Attached child article and list of children
|
||||
|
||||
```json
|
||||
{
|
||||
"article": {
|
||||
"id": 1,
|
||||
"categoryId": 1,
|
||||
"name": "…",
|
||||
"sku": "…",
|
||||
"track_stock": true
|
||||
},
|
||||
"children": [
|
||||
{}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Errors
|
||||
|
||||
| Status | Description |
|
||||
|--------|-------------|
|
||||
| 400 | Missing sku or attribute value, or invalid input |
|
||||
| 404 | Father or child article not found |
|
||||
| 409 | Article already belongs to another father, or variant value already exists |
|
||||
|
||||
---
|
||||
|
||||
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|
||||
Reference in New Issue
Block a user