Files
dashback/docs/api/routes/shipping/_id.patch.md
2026-10-12 19:48:04 +02:00

68 lines
1.6 KiB
Markdown

# `PATCH /shipping/{id}`
Protected. Requires a valid session cookie (`credentials: 'include'`).
Update shipping
Updates a shipping record. If transitioned to `shipped`, stock is adjusted
via ledger and article history is written. Once shipped, it cannot be undone.
## Path parameters
| Param | Required | Type | Description |
|-------|----------|------|-------------|
| `id` | yes | integer | Shipping ID |
## Body (JSON)
| Field | Required | Type | Description |
|-------|----------|------|-------------|
| `type` | no | string | |
| `state` | no | string | |
| `trackingCode` | no | string | Carrier parcel tracking code |
| `carrier` | no | string | Carrier name (e.g. DHL, UPS, DPD) |
| `warehouseId` | no | integer | Warehouse ID for stock deduction when transitioning to shipped |
```json
{
"type": "…",
"state": "…",
"trackingCode": "…",
"carrier": "…",
"warehouseId": 1
}
```
## Response `200`
Updated shipping
```json
{
"shipping": {
"id": 1,
"manifestId": 1,
"number": "…",
"trackingCode": "…",
"carrier": "…",
"type": "…",
"state": "…"
}
}
```
## Errors
| Status | Description |
|--------|-------------|
| 400 | Validation error or no company selected — `{"error":"…"}` |
| 401 | Unauthorized — `{"error":"…"}` |
| 403 | Not authorized — `{"error":"…"}` |
| 404 | Shipping or warehouse not found — `{"error":"…"}` |
| 409 | Shipped shipping cannot be undone, or order already shipped — `{"error":"…"}` |
---
_Generated from `@openapi` JSDoc. Do not edit by hand — run `npm run docs:api`._