Files
dashback/docs/api/routes/article/add-image.md
seb 1860f38640 Add delivery and supplier HTTP APIs with expanded response docs.
Wire store-backed CRUD for goods receipts and suppliers, and teach the API doc generator to expand $ref/allOf/array samples so route markdown shows full JSON shapes.
2026-08-06 05:32:48 +02:00

63 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# `POST /article/{sku}/image`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Add article image
Accepts a full-size AVIF body (`Content-Type: image/avif`).
Full: stored as-is when already AVIF and ≤1000×1000; otherwise scaled to max 1000×1000.
Thumb always scaled to max 200×200. Stores hash/thumbhash, links `articlepic`.
Auth like GET by SKU.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `sku` | yes | string | Article SKU |
## Body
Raw binary (`image/avif`).
## Signals
On success, emits SSE signal: `article-<sku>` (see [`GET /events`](../events.md)).
## Response `201`
Image stored and linked
```json
{
"image": {
"picId": 1,
"sort": 1,
"full": {
"w": 1,
"h": 1,
"size": 1
},
"thumb": {
"w": 1,
"h": 1
},
"hash": "…",
"thumbHash": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing body or invalid image — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Article not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._