65 lines
1.3 KiB
Markdown
65 lines
1.3 KiB
Markdown
# `POST /brand`
|
|
|
|
Protected. Requires a valid session cookie (`credentials: 'include'`).
|
|
|
|
Create brand
|
|
|
|
Creates a brand for the selected company. Fails with `Brand already exists`
|
|
if the name is taken. Emits SSE signal `brand` with payload
|
|
`{ sender, brandId }` (`sender` echoes the caller's `x-client-id`).
|
|
|
|
|
|
## Body (JSON)
|
|
|
|
| Field | Required | Type | Description |
|
|
|-------|----------|------|-------------|
|
|
| `name` | yes | string | |
|
|
| `gsprpinfo` | no | string | |
|
|
|
|
```json
|
|
{
|
|
"name": "Acme",
|
|
"gsprpinfo": "Acme GmbH"
|
|
}
|
|
```
|
|
|
|
## Signals
|
|
|
|
On success, emits SSE signal: `brand` (see [`GET /events`](../events.md)).
|
|
|
|
## Response `201`
|
|
|
|
Created brand
|
|
|
|
```json
|
|
{
|
|
"brand": {
|
|
"id": 1,
|
|
"name": "…",
|
|
"gsprpinfo": "…",
|
|
"pics": [
|
|
{
|
|
"fullHash": "…",
|
|
"thumbW": 1,
|
|
"thumbH": 1,
|
|
"thumbHash": "…"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
```
|
|
|
|
## Errors
|
|
|
|
| Status | Description |
|
|
|--------|-------------|
|
|
| 400 | Invalid brand or no company selected — `{"error":"…"}` |
|
|
| 401 | Unauthorized — `{"error":"…"}` |
|
|
| 403 | Not authorized — `{"error":"…"}` |
|
|
| 404 | Company not found — `{"error":"…"}` |
|
|
| 409 | Brand already exists — `{"error":"…"}` |
|
|
|
|
---
|
|
|
|
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._
|