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.

GET POST PUT DELETE 5 Endpoints
Base URL https://bogusapi.com/api/orders
GET /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.

Query Parameters
ParameterTypeDefaultDescription
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.
Response: 200 OK
GET /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.

Path Parameters
ParameterTypeRequiredDescription
id integer Required Unique order identifier
Response: 200 OK
GET /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.

Response: 404 Not Found
POST /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.

Request Body
Field Type Required Description
cartId integer Required Cart id
userId integer Optional User id
Body
Response: 200 OK
PUT /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.

Request Body
Field Type Required Description
userId integer Optional User id
items updateorderitemdto[] Optional Items
Order Item (items[])
Field Type Required Description
productId integer Required Product id
quantity integer Required Quantity
Body
Response: 200 OK
DELETE /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.

Path Parameters
ParameterTypeRequiredDescription
id integer Required ID of the order to delete
Response: 204 No Content