Référence API
Appelez le moteur d'emballage directement via HTTP. Envoyez un envoi (produits et types de cartons) et recevez l'ensemble optimal de colis. Les réponses sont déterministes pour une requête donnée.
URL de base
http://localhost:5180
Authentification
Chaque requête doit inclure votre clé API dans l'en-tête X-Api-Key. Contactez votre administrateur Paxon pour obtenir une clé.
X-Api-Key: your-api-key
Point de terminaison
POST http://localhost:5180/api/v1/pack
Champs de la requête
| 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). |
Champs de la réponse
| 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. |
Statut du résultat
SUCCESS : une solution a été trouvée. NO_SOLUTION : prouvé impossible dans les limites. NOT_FOUND : aucune solution trouvée mais l'impossibilité n'est pas prouvée (voir timedOut). ERROR : la requête était invalide (voir errors).
Erreurs
Une saisie invalide renvoie un HTTP 200 avec le statut ERROR et un tableau errors ; chaque entrée a un code (un chemin de champ tel que products[0].weight) et un message lisible.
Limites
Jusqu'à 100 requêtes par minute et par adresse IP ; les corps de requête sont limités à 1 MB.
Exemple de requête
{
"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 }
]
}
Exemple de réponse
{
"success": true,
"parcelsUsed": 1,
"boxes": [ { "boxTypeId": "A1", "contentsHeight": 20, "cutHeight": 20, "placements": [ { "productId": "SKU-1" } ] } ],
"boxlessItems": [],
"status": "SUCCESS",
"timedOut": false,
"runtimeMs": 3
}