Files
dashback/docs/api/routes/attributevalue/_id/image.post.md
2026-10-11 17:26:29 +02:00

65 lines
1.3 KiB
Markdown

# `POST /attributevalue/{id}/image`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Add or replace attribute value image
Uploads an image for the attribute value (AVIF, WebP, or octet-stream). Converted to AVIF full and thumbnail.
Replaces any existing image for this attribute value. Emits SSE signal `attributename`.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Attribute value id |
## Body
Raw binary (`image/avif`).
Raw binary (`image/webp`).
Raw binary (`application/octet-stream`).
## Signals
On success, emits SSE signal: `attributename` (see [`GET /events`](../events.md)).
## Response `201`
Image stored and linked
```json
{
"attributevalue": {
"id": 1,
"fullHash": "…",
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…",
"pics": [
{
"fullHash": "…",
"thumbW": 1,
"thumbH": 1,
"thumbHash": "…"
}
]
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Missing body or invalid image — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Attribute value not found — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._