Orders API
v1.0 • REST • JSON
Full CRUD management for order accounts. Create, retrieve, update, and delete order records with built-in pagination and role-based access control support.
Quick Reference
/api/orders
200 OK
Get All Orders
Retrieves a paginated list of all orders in the system. Use the pageNumber
and pageSize query parameters to navigate large result sets.
The response envelope includes total count and page metadata.
| Parameter | Type | Default | Description |
|---|---|---|---|
pageNumber |
integer | 1 |
Page number, 1-based index. Values below 1 are treated as 1. |
pageSize |
integer | 10 |
Number of records per page, from 1 to 100. Values outside this range are clamped. |
/api/orders/{id}
200 OK
Get Single Order
Fetch the full profile for a specific order using their numeric ID. Returns all order fields including assigned role names and account metadata.
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Required | Unique order identifier |
/api/orders/{id}
404 Not Found
Order Not Found
Returned when the requested order ID does not exist in the system. Use this example to test error-handling logic and build graceful fallback UI for missing order resources.
/api/orders/checkout
200 OK
Create Order
Checks out an existing cart: creates an order from the cart's items using current product prices and calculates the total. Returns 200 OK with the new order, or 404 Not Found if the cart does not exist.
| Field | Type | Required | Description |
|---|---|---|---|
cartId |
integer | Required | Cart id |
userId |
integer | Optional | User id |
/api/orders/{id}
200 OK
Update Order
Replaces the order's user and items. Each item needs a productId and a
quantity (1 to 1000); prices are taken from the current product prices and the
total is recalculated. A successful update returns 200 OK with response body.
| Field | Type | Required | Description |
|---|---|---|---|
userId |
integer | Optional | User id |
items |
updateorderitemdto[] | Optional | Items |
| Field | Type | Required | Description |
|---|---|---|---|
productId |
integer | Required | Product id |
quantity |
integer | Required | Quantity |
/api/orders/{id}
204 No Content
Delete Order
Permanently removes an order by its ID, together with its items. Returns 409 Conflict if the order has payments, because financial history is kept. This action cannot be undone.
| Parameter | Type | Required | Description |
|---|---|---|---|
id |
integer | Required | ID of the order to delete |