REST API v2
Prefix: /api/v2 · OpenAPI: /api/v2/openapi.json
Meta
GET /api/v2/meta
Returnează versiune, feature flags, changelog URL.
Endpoints
| Metodă | Cale | Descriere |
|---|---|---|
| GET | /api/v2/articles |
Listă articole, sparse fieldset ?fields=id,code,name |
| GET | /api/v2/stock |
Stoc cu paginare cursor (?cursor= / next_cursor) |
| GET | /api/v2/packaging/balances |
Solduri ambalaje |
| GET | /api/v2/packaging/movements |
Istoric mișcări ambalaje |
| POST | /api/v2/sales-orders |
Creare SO |
| PATCH | /api/v2/sales-orders/{id}/status |
Doar schimbare status |
| GET | /api/v2/webhooks |
Listă webhooks |
| POST | /api/v2/webhooks |
Creare webhook |
| POST | /api/v2/batch |
Batch requests |
Paginare cursor (stoc)
GET /api/v2/stock?cursor=eyJpZCI6MTAwfQ
Authorization: Bearer {token}
X-Company-Id: 42
Răspuns include next_cursor până la epuizare.
Batch
POST /api/v2/batch
Content-Type: application/json
{
"requests": [
{ "method": "GET", "path": "/api/v2/stock?per_page=10" },
{ "method": "GET", "path": "/api/v2/articles?per_page=5" }
]
}
Execuție secvențială în aceeași sesiune company context.
Diferențe față de v1
| Aspect | v1 | v2 |
|---|---|---|
| Paginare stoc | page | cursor |
| Packaging | — | da |
| Batch | — | da |
| PATCH status SO | via PUT/PATCH full | endpoint dedicat |
Pentru CRUD complet PO/recepții, folosiți v1 până la paritate v2.
Headers
Identice cu v1: Authorization, X-Company-Id, opțional X-Three-Pl-Id.
Ambalaje returnabile (v2)
| Endpoint | Descriere |
|---|---|
GET /api/v2/packaging/balances |
Sold curent per tip ambalaj |
GET /api/v2/packaging/movements |
Istoric mișcări ambalaje |
Eveniment webhook: packaging.movement_recorded.
Răspuns batch — structură
{
"responses": [
{"status": 200, "body": {"data": []}},
{"status": 200, "body": {"data": []}}
]
}
Fiecare sub-request moștenește contextul X-Company-Id al request-ului părinte.
Când alegeți v2
| Scenariu | v2 |
|---|---|
| Export stoc 100k+ linii | Cursor pe /api/v2/stock |
| Frontend cu field picking | ?fields=id,code,name pe articole |
| Doar schimbare status SO | PATCH .../status dedicat |
| 5–10 GET-uri paralele | Un singur POST /batch |
Exemple curl
Exemple requesturi — secțiunile 3, 4, 8.