API-Referenz
Rufen Sie die Pack-Engine direkt über HTTP auf. Senden Sie eine Sendung (Produkte und Kartontypen) und erhalten Sie das optimale Set an Paketen. Antworten sind für eine gegebene Anfrage deterministisch.
Basis-URL
http://localhost:5180
Authentifizierung
Jede Anfrage muss Ihren API-Schlüssel im Header X-Api-Key enthalten. Wenden Sie sich an Ihren Paxon-Administrator, um einen Schlüssel zu erhalten.
X-Api-Key: your-api-key
Endpoint
POST http://localhost:5180/api/v1/pack
Anfragefelder
| 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). |
Antwortfelder
| 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. |
Ergebnisstatus
SUCCESS: Es wurde eine Lösung gefunden. NO_SOLUTION: innerhalb der Grenzen nachweislich unmöglich. NOT_FOUND: keine Lösung gefunden, aber Unmöglichkeit nicht bewiesen (siehe timedOut). ERROR: die Anfrage war ungültig (siehe errors).
Fehler
Ungültige Eingaben liefern HTTP 200 mit Status ERROR und einem errors-Array; jeder Eintrag hat einen code (einen Feldpfad wie products[0].weight) und eine lesbare message.
Limits
Bis zu 100 Anfragen pro Minute und IP-Adresse; Anfragetexte sind auf 1 MB begrenzt.
Beispielanfrage
{
"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 }
]
}
Beispielantwort
{
"success": true,
"parcelsUsed": 1,
"boxes": [ { "boxTypeId": "A1", "contentsHeight": 20, "cutHeight": 20, "placements": [ { "productId": "SKU-1" } ] } ],
"boxlessItems": [],
"status": "SUCCESS",
"timedOut": false,
"runtimeMs": 3
}