API Reference
Complete API documentation for the Lab Equipment Management System.
Base URL
Production: https://api.lems.example.com
Development: http://localhost:5000Authentication
All API requests require authentication using JWT or PASETO tokens.
🔐 Authentication Headers
Authorization: Bearer <your-token>Rate Limiting
API requests are limited to 100 requests per minute per IP address.
Response Format
All API responses follow this standard format:
json
{
"success": true,
"data": {},
"message": "Operation completed successfully",
"timestamp": "2025-01-06T10:30:00Z"
}Error Responses
json
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input data",
"details": {}
},
"timestamp": "2025-01-06T10:30:00Z"
}HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Success |
| 201 | Created |
| 400 | Bad Request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not Found |
| 429 | Too Many Requests |
| 500 | Internal Server Error |
API Endpoints Overview
Authentication
POST /api/auth/login- User loginPOST /api/auth/register- User registrationPOST /api/auth/refresh- Refresh tokenPOST /api/auth/logout- User logoutPOST /api/auth/forgot-password- Password reset
Users
GET /api/users- List usersGET /api/users/:id- Get user detailsPUT /api/users/:id- Update userDELETE /api/users/:id- Delete user
Products
GET /api/products- List productsGET /api/products/:id- Get product detailsPOST /api/products- Create productPUT /api/products/:id- Update productDELETE /api/products/:id- Delete product
Requests
GET /api/requests- List requestsGET /api/requests/:id- Get request detailsPOST /api/requests- Create requestPUT /api/requests/:id- Update requestPOST /api/requests/:id/approve- Approve requestPOST /api/requests/:id/reject- Reject request
Notifications
GET /api/notifications- List notificationsPOST /api/notifications- Create notificationPUT /api/notifications/:id/read- Mark as read
Quick Start Example
javascript
// Login
const response = await fetch('/api/auth/login', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
email: 'user@example.com',
password: 'password123'
})
});
const { data } = await response.json();
const token = data.token;
// Get products
const products = await fetch('/api/products', {
headers: {
'Authorization': `Bearer ${token}`
}
});Next Steps
Explore specific endpoint documentation:
