Dokumentacja API
Wywołaj silnik pakowania bezpośrednio przez HTTP. Wyślij przesyłkę (produkty i typy pudełek) i otrzymaj optymalny zestaw paczek. Odpowiedzi są deterministyczne dla danego żądania.
Adres bazowy URL
http://localhost:5180
Uwierzytelnianie
Każde żądanie musi zawierać Twój klucz API w nagłówku X-Api-Key. Skontaktuj się z administratorem Paxon, aby uzyskać klucz.
X-Api-Key: your-api-key
Punkt końcowy
POST http://localhost:5180/api/v1/pack
Pola żądania
| Field | Type | Notes |
|---|---|---|
| maxParcels | int | Max parcels (boxes + boxless). |
| rotationMode | string | None | UprightOnly | Free. |
| products | array | id, length, width, height (mm), weight (g), quantity, breakable, dg, boxless?, orientationConstrained?, tags?. |
| boxTypes | array | id, length, width, height (mm), maxWeight (g), breakableAllowed, dgAllowed, priority (lower preferred), minCutHeight? (mm — the machine can trim the box down to this height). |
| rules | array? | type (keep-separate | keep-together | limit-quantity), tagA, tagB?, quantity?. |
| maxRuntimeSeconds | int? | Override the solve budget (bounded by a server ceiling). |
| forceRecompute | bool? | Bypass the cache lookup (result still cached). |
Pola odpowiedzi
| Field | Type | Notes |
|---|---|---|
| status | string | SUCCESS | NO_SOLUTION | NOT_FOUND | ERROR. |
| parcelsUsed | int | Boxes + boxless items used. |
| boxes | array | Chosen boxes with their placements, contentsHeight (mm, how tall the contents stack) and cutHeight? (mm, present only when the box is cuttable). |
| boxlessItems | array | Items shipped without a box. |
| timedOut | bool | True if the solve budget elapsed. |
| runtimeMs | long | Solve time in milliseconds. |
| errors | array? | Present when status is ERROR. |
Status wyniku
SUCCESS: znaleziono rozwiązanie. NO_SOLUTION: udowodniono niemożliwość w ramach limitów. NOT_FOUND: nie znaleziono rozwiązania, ale niemożliwość nie została udowodniona (zobacz timedOut). ERROR: żądanie było nieprawidłowe (zobacz errors).
Błędy
Nieprawidłowe dane wejściowe zwracają HTTP 200 ze statusem ERROR i tablicą errors; każdy wpis ma code (ścieżkę pola, np. products[0].weight) oraz czytelną wiadomość.
Limity
Do 100 żądań na minutę na adres IP; treść żądania jest ograniczona do 1 MB.
Przykładowe żądanie
{
"maxParcels": 6,
"rotationMode": "Free",
"products": [
{ "id": "SKU-1", "length": 220, "width": 150, "height": 20, "weight": 500, "quantity": 1, "breakable": false, "dg": false }
],
"boxTypes": [
{ "id": "A1", "length": 225, "width": 150, "height": 100, "maxWeight": 15000, "breakableAllowed": true, "dgAllowed": true, "priority": 20, "minCutHeight": 20 }
]
}
Przykładowa odpowiedź
{
"success": true,
"parcelsUsed": 1,
"boxes": [ { "boxTypeId": "A1", "contentsHeight": 20, "cutHeight": 20, "placements": [ { "productId": "SKU-1" } ] } ],
"boxlessItems": [],
"status": "SUCCESS",
"timedOut": false,
"runtimeMs": 3
}