Package Commands

Operations for managing package state transitions and commands

Update or create shipment label for a package

post

Executes the UpdateShipmentLabelOfThePackageCommand to create or update the shipping label for a package.

Prerequisites:

  • Package must be in preparing, waiting_cargo_label, packed, or shipped state

  • Package must have an associated shipment

  • Valid state transition must exist from source state to destination state

  • Either transition (transition ID) or slug (transition slug) must be provided in the request body

Request Requirements:

  • If transition is provided, slug is not required

  • If slug is provided, transition is not required

  • At least one of transition or slug must be present

Process:

  1. Validates package state and parameters

  2. Checks that package has an associated shipment

  3. Locks the package for processing

  4. Calls ShippingLabelService to create/update shipping label

  5. If package is in waiting_cargo_label state and destination is packed, transitions package state

  6. Fires PackagePackedStateEvent when transitioning to packed state

  7. Validates that shipping label was successfully created

Side Effects:

  • Shipping label is created or updated for the package

  • Package state may be transitioned (waiting_cargo_label → packed)

  • PackagePackedStateEvent is triggered on state transition

  • Label is retrieved from cargo company integration

Response:

  • Returns HTTP 204 No Content on success

  • The updated package with shipping label can be retrieved separately if needed

Authorizations
TokenstringRequired

API key for authentication

Path parameters
packageIdinteger · int64Required

The ID of the package to update shipment label for

Example: 12345
Body

Request body for updating shipment label. Either transition or slug must be provided.

  • If transition is provided, slug is not required
  • If slug is provided, transition is not required
  • Providing both is allowed but not necessary
transitionintegerOptional

State transition ID to execute (required if slug is not provided)

Example: 925
slugstringOptional

State transition slug to execute (required if transition is not provided)

Example: UPDATE_SHIPMENT_LABEL
Responses
post
/packages/{packageId}/command/

No content

Last updated

Was this helpful?