ms-pedidos) manages the full order lifecycle in SmartLogix. Orders begin in PENDIENTE status and progress through APROBADO → EN_ENVIO → ENTREGADO, or may be moved to CANCELADO. When creating an order, the service calls ms-inventario to verify stock; if the inventory service is unreachable, the circuit breaker opens and the request fails immediately rather than hanging.
All endpoints require a valid JWT token in the Authorization header.
Order creation depends on the inventory service being available. If
ms-inventario is down or unresponsive, the Resilience4j circuit breaker trips and POST /api/pedidos returns an error. Ensure ms-inventario is healthy before creating orders.GET /api/pedidos
Return the complete list of orders across all users.Status codes
| Code | Meaning |
|---|---|
200 | Success. Returns an array of OrderDTO objects. |
Response fields
Auto-generated order identifier.
Identifier of the user who placed the order.
Email address of the user who placed the order.
Full name of the end customer.
Order total amount.
Current order status. One of
PENDIENTE, APROBADO, EN_ENVIO, ENTREGADO, or CANCELADO.Order type:
NACIONAL or INTERNACIONAL.Destination city or country.
Logistics notes. Auto-populated for
INTERNACIONAL orders with customs information.ISO-8601 timestamp of when the order was created.
Example
POST /api/pedidos
Create a new order. Before persisting, the service callsGET /api/inventario/{productoId}/stock?cantidad={cantidad} on ms-inventario through a Resilience4j circuit breaker. If stock is insufficient or the circuit breaker is open, the request fails. For INTERNACIONAL orders, observaciones is automatically set to describe customs requirements.
Orders are created with an initial status of PENDIENTE.
Request body
The ID of the user placing the order.
The email address of the user placing the order.
Full name of the end customer.
Order total amount.
Order type. Must be
NACIONAL or INTERNACIONAL.Destination city or country for delivery.
ID of the product to verify stock for via the circuit breaker.
Number of units required. Used for the stock check against
ms-inventario.Status codes
| Code | Meaning |
|---|---|
201 | Order created. Returns the new OrderDTO. |
400 | Insufficient stock, validation error, or circuit breaker fallback triggered. |
503 | Inventory service unavailable and circuit breaker is open. |
Example
GET /api/pedidos/
Retrieve a single order by its numeric ID.Path parameters
The order’s auto-generated identifier.
Status codes
| Code | Meaning |
|---|---|
200 | Order found. Returns an OrderDTO. |
404 | No order with the given ID. |