Skip to content

API Reference

Complete API documentation for the Lab Equipment Management System.

Base URL

Production: https://api.lems.example.com
Development: http://localhost:5000

Authentication

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

CodeDescription
200Success
201Created
400Bad Request
401Unauthorized
403Forbidden
404Not Found
429Too Many Requests
500Internal Server Error

API Endpoints Overview

Authentication

  • POST /api/auth/login - User login
  • POST /api/auth/register - User registration
  • POST /api/auth/refresh - Refresh token
  • POST /api/auth/logout - User logout
  • POST /api/auth/forgot-password - Password reset

Users

  • GET /api/users - List users
  • GET /api/users/:id - Get user details
  • PUT /api/users/:id - Update user
  • DELETE /api/users/:id - Delete user

Products

  • GET /api/products - List products
  • GET /api/products/:id - Get product details
  • POST /api/products - Create product
  • PUT /api/products/:id - Update product
  • DELETE /api/products/:id - Delete product

Requests

  • GET /api/requests - List requests
  • GET /api/requests/:id - Get request details
  • POST /api/requests - Create request
  • PUT /api/requests/:id - Update request
  • POST /api/requests/:id/approve - Approve request
  • POST /api/requests/:id/reject - Reject request

Notifications

  • GET /api/notifications - List notifications
  • POST /api/notifications - Create notification
  • PUT /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:

Lab Equipment Management System Documentation