69 lines
1.6 KiB
Markdown
69 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 |
|
|
| `carrierId` | no | integer | Carrier ID |
|
|
| `warehouseId` | no | integer | Warehouse ID for stock deduction when transitioning to shipped |
|
|
|
|
```json
|
|
{
|
|
"type": "…",
|
|
"state": "…",
|
|
"trackingCode": "…",
|
|
"carrierId": 1,
|
|
"warehouseId": 1
|
|
}
|
|
```
|
|
|
|
## Response `200`
|
|
|
|
Updated shipping
|
|
|
|
```json
|
|
{
|
|
"shipping": {
|
|
"id": 1,
|
|
"manifestId": 1,
|
|
"number": "…",
|
|
"trackingCode": "…",
|
|
"carrierId": 1,
|
|
"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`._
|