Files
dashback/docs/api/routes/carrier/_id.patch.md
2026-10-17 05:10:25 +02:00

66 lines
1.3 KiB
Markdown

# `PATCH /carrier/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update carrier
Updates carrier name, sort order, hasPackages, and/or isReverse for the selected company.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Carrier ID |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `name` | no | string | |
| `sort` | no | integer | |
| `hasPackages` | no | boolean | |
| `isReverse` | no | boolean | |
```json
{
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
```
## Signals
On success, emits SSE signal: `carrier` (see [`GET /events`](../events.md)).
## Response `200`
Updated carrier
```json
{
"carrier": {
"id": 1,
"name": "…",
"sort": 1,
"hasPackages": true,
"isReverse": true
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Invalid input or missing fields — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Carrier not found — `{"error":"…"}` |
| 409 | Carrier already exists — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._