ms-envios) manages the physical dispatch of orders. When a shipment is created, EnvioFactory selects the appropriate concrete creator based on tipoEnvio: TERRESTRE shipments receive an estimated delivery date of now + 5 days; EXPRESS shipments receive now + 1 day. A route description and guide number (guiaDespecho) are generated automatically. Shipments maintain their own status lifecycle, independent of the parent order.
All endpoints require a valid JWT token in the Authorization header.
GET /api/envios
Return the complete list of all shipments.Status codes
| Code | Meaning |
|---|---|
200 | Success. Returns an array of EnvioDTO objects. |
Response fields
Auto-generated shipment identifier.
ID of the order this shipment fulfills.
Current shipment status. One of
CREADO, ASIGNADO, EN_RUTA, or ENTREGADO.Shipment type:
TERRESTRE or EXPRESS.Name of the carrier company handling this shipment.
Auto-generated tracking or dispatch guide number.
Auto-generated route description based on
tipoEnvio and destino.Destination city or address.
ISO-8601 estimated delivery timestamp.
now + 5 days for TERRESTRE; now + 1 day for EXPRESS.ISO-8601 timestamp of when the shipment record was created.
Example
POST /api/envios
Create a new shipment for a given order.EnvioFactory uses the tipoEnvio value to instantiate the correct fulfillment strategy. The service auto-generates rutaDescripcion, guiaDespecho, and fechaEstimadaEntrega. The initial status is always CREADO.
Request body
ID of the order to fulfil with this shipment.
Shipment type. Must be
TERRESTRE or EXPRESS. Determines the carrier strategy and delivery date.Name of the carrier company (e.g.
"Servientrega", "DHL").Destination city or address for delivery.
Status codes
| Code | Meaning |
|---|---|
201 | Shipment created. Returns the new EnvioDTO. |
400 | Validation failed or invalid tipoEnvio value. |
Example
GET /api/envios/
Retrieve a single shipment by its numeric ID.Path parameters
The shipment’s auto-generated identifier.
Status codes
| Code | Meaning |
|---|---|
200 | Shipment found. Returns an EnvioDTO. |
404 | No shipment with the given ID. |
Example
PATCH /api/envios//status
Update the status of an existing shipment. Valid status transitions follow the lifecycle:CREADO → ASIGNADO → EN_RUTA → ENTREGADO. The service does not enforce transition order, so any of the four values can be set directly.
Path parameters
The shipment’s auto-generated identifier.
Query parameters
New status value. Must be one of:
CREADO, ASIGNADO, EN_RUTA, ENTREGADO.Status codes
| Code | Meaning |
|---|---|
200 | Status updated. Returns the updated EnvioDTO. |
400 | Invalid status value. |
404 | No shipment with the given ID. |