API Reference
REST API documentation for TL21 Warehouse Management System
Overview
The TL21 Warehouse Management API provides secure RESTful endpoints for managing orders and warehouse operations.
https://localhost:7001/apiASP.NET Core Identity (Required)
JSON (application/json)
Orders API Endpoints
Complete CRUD operations for managing orders in the warehouse system.
/api/orders
Get All OrdersRetrieve a paginated list of orders with optional filtering.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
status |
string | No | Filter by order status |
orderType |
string | No | Filter by order type |
pageNumber |
integer | No | Page number (default: 1) |
pageSize |
integer | No | Items per page (default: 10) |
Response: 200 OK
[
{
"id": 1,
"publicKey": "550e8400-e29b-41d4-a716-446655440000",
"orderNumber": "ORD-2024-001",
"orderType": "Sales",
"status": "Pending",
"customerName": "John Doe",
"totalAmount": 1500.00,
"createdAt": "2024-01-15T10:30:00Z"
}
]/api/orders/{id}
Get Order by IDRetrieve a specific order by its ID.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id |
integer | Order ID |
Responses
/api/orders
Create New OrderCreate a new order in the system.
Request Body
{
"orderNumber": "ORD-2024-002",
"orderType": "Sales",
"status": "Pending",
"customerName": "Jane Smith",
"customerEmail": "jane.smith@example.com",
"totalAmount": 2500.00,
"warehouseId": 1,
"priority": "P1"
}
Responses
/api/orders/{id}
Update OrderUpdate an existing order with complete data.
Responses
/api/orders/{id}
Partial Update OrderUpdate specific fields of an order.
Request Body Example
{
"status": "Delivered",
"notes": "Package delivered successfully"
}/api/orders/{id}
Delete OrderDelete an order from the system.
Responses
/api/orders/statistics
Get Order StatisticsRetrieve aggregated statistics about orders.
Response: 200 OK
{
"totalOrders": 150,
"pendingOrders": 25,
"readyForPickup": 30,
"onTrack": 40,
"delivered": 50,
"cancelled": 5,
"totalRevenue": 125000.00,
"averageOrderValue": 833.33
}Shipments API Endpoints
Complete CRUD operations for managing shipments in the warehouse system.
/api/shipments
Get All ShipmentsRetrieve a paginated list of shipments with optional filtering.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
status |
string | No | Filter by shipment status |
carrier |
string | No | Filter by carrier name |
orderId |
integer | No | Filter by order ID |
pageNumber |
integer | No | Page number (default: 1) |
pageSize |
integer | No | Items per page (default: 10) |
Response: 200 OK
[
{
"id": 1,
"publicKey": "650e8400-e29b-41d4-a716-446655440000",
"shipmentNumber": "SHP-2024-001",
"orderId": 1,
"carrier": "FedEx",
"trackingNumber": "1234567890",
"status": "InTransit",
"shippingCost": 45.00,
"weight": 12.5,
"createdAt": "2024-01-15T10:30:00Z"
}
]/api/shipments/{id}
Get Shipment by IDRetrieve a specific shipment by its ID.
Responses
/api/shipments/by-tracking/{trackingNumber}
Get Shipment by Tracking NumberRetrieve a specific shipment by its tracking number.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
trackingNumber |
string | Shipment tracking number |
/api/shipments
Create New ShipmentCreate a new shipment in the system.
Request Body
{
"shipmentNumber": "SHP-2024-002",
"orderId": 1,
"carrier": "UPS",
"trackingNumber": "9876543210",
"status": "Preparing",
"shippingCost": 55.00,
"weight": 15.0,
"sourceAddress": "123 Warehouse St",
"destinationAddress": "456 Customer Ave",
"isInternational": false
}
Responses
/api/shipments/{id}
Update ShipmentUpdate an existing shipment with complete data.
Responses
/api/shipments/{id}
Partial Update ShipmentUpdate specific fields of a shipment.
Request Body Example
{
"status": "Delivered",
"actualDeliveryDate": "2024-01-20T14:30:00Z",
"currentLeg": "Delivered"
}/api/shipments/{id}
Delete ShipmentDelete a shipment from the system.
Responses
/api/shipments/statistics
Get Shipment StatisticsRetrieve aggregated statistics about shipments.
Response: 200 OK
{
"totalShipments": 200,
"preparing": 15,
"shipped": 20,
"inTransit": 50,
"delivered": 110,
"failed": 5,
"totalShippingCost": 9500.00,
"averageShippingCost": 47.50,
"totalWeight": 2500.0,
"averageWeight": 12.5,
"internationalShipments": 25
}Data Models
Order Status Values
- Pending Order created but not processed
- Ready for Pickup Ready to be picked up from warehouse
- On Track Order in transit
- Delivered Order delivered
- Cancelled Order cancelled
Order Type Values
- Sales - Sales order
- Transfer - Transfer between warehouses
- Return - Return order
Priority Values
- P0 - Immediately (highest priority)
- P1 - 30 days
- P2 - 90 days
Shipment Status Values
- Preparing Shipment is being prepared
- Shipped Shipment has been dispatched
- InTransit Shipment is in transit
- Delivered Shipment delivered
- Failed Shipment failed
Authentication & Security
All API endpoints require authentication using ASP.NET Core Identity. Users must be logged into the system to access the API.
Security Features
- Authentication required for all endpoints
- Input validation and model binding
- SQL injection protection via Entity Framework
- Concurrency control for updates
- Comprehensive error logging
Error Handling
The API returns standard HTTP status codes and error messages in JSON format.
Common HTTP Status Codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request successful |
| 201 | Created | Resource created successfully |
| 204 | No Content | Request successful, no content to return |
| 400 | Bad Request | Invalid request data |
| 401 | Unauthorized | Authentication required |
| 404 | Not Found | Resource not found |
| 409 | Conflict | Concurrency error |
| 500 | Internal Server Error | Server error occurred |