Orders API
Order management system for e-commerce applications with status tracking and user associations.
List Orders
Get a paginated list of orders with optional filtering by user and status.
GET https://responserift.dev/api/orders?userId=1&status=Processing&limit=10&offset=0
Query Parameters
userId
- Filter orders by user IDstatus
- Filter by order status (e.g., "Processing", "Shipped", "Delivered")limit
- Number of results (default: 100)offset
- Number of results to skip (default: 0)
Response
{
"total": 25,
"limit": 10,
"offset": 0,
"results": [
{
"id": 1,
"userId": 1,
"cartId": 5,
"totalPrice": 149.98,
"status": "Processing",
"createdAt": "2024-01-15T10:30:00.000Z"
}
]
}
Get Order
Retrieve a specific order by ID.
GET https://responserift.dev/api/orders/1
Create Order
Create a new order from a shopping cart.
POST https://responserift.dev/api/orders
Content-Type: application/json
{
"userId": 1,
"cartId": 5,
"totalPrice": 149.98,
"status": "Processing"
}
Required fields: userId, cartId, totalPrice
Optional fields: status (defaults to "Processing")
Auto-generated: createdAt (current timestamp)
Update Order
Update an existing order (typically used for status changes).
PUT https://responserift.dev/api/orders/1
Content-Type: application/json
{ "status": "Shipped" }
Delete Order
Remove an order from the system.
DELETE https://responserift.dev/api/orders/1
Order Structure
Fields
id
- Unique order identifieruserId
- ID of the user who placed the ordercartId
- ID of the shopping cart used for the ordertotalPrice
- Total cost of the order (must be non-negative)status
- Current order status (e.g., "Processing", "Shipped", "Delivered")createdAt
- ISO timestamp when order was created
Common Order Statuses
Processing
- Order is being preparedShipped
- Order has been shippedDelivered
- Order has been deliveredCancelled
- Order has been cancelled
Warning: All mutations are in-memory only and reset on server restart.