Introduction
The Energy CMMS API provides programmatic access to the Computerized Maintenance Management System for energy infrastructure. Built on Django REST Framework, it enables integration with external systems for asset management, maintenance operations, document management, and inventory control.Base URL
API Architecture
The API follows RESTful principles and is organized into the following main modules:Assets
Manage assets, locations, categories, and hierarchies
Maintenance
Work orders, routines, schedules, and maintenance operations
Documents
Document management with AI-powered search and processing
Inventory
Materials, stock tracking, and requisitions
Authentication
All API endpoints require authentication using Django’s session-based authentication or token-based authentication. See the Authentication section for details.Most endpoints require the
@login_required or @staff_member_required decorator, ensuring only authenticated users can access the API.Request Format
The API accepts requests with the following content types:application/json- For JSON payloadsapplication/x-www-form-urlencoded- For form datamultipart/form-data- For file uploads
Standard Request Headers
Response Format
All API responses are returned in JSON format with consistent structure:Success Response
Error Response
HTTP Status Codes
The API uses standard HTTP status codes:| Code | Description |
|---|---|
| 200 | Success - Request completed successfully |
| 201 | Created - Resource created successfully |
| 400 | Bad Request - Invalid request parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource not found |
| 405 | Method Not Allowed - HTTP method not supported |
| 500 | Internal Server Error - Server error occurred |
Pagination
Endpoints that return lists support pagination using Django’s Paginator:Pagination Response
Filtering and Search
Many endpoints support filtering via query parameters:q- Full-text search querycategoryorcat_id- Filter by category IDubicacion_idorloc_id- Filter by location IDpage- Page number for pagination
CORS Configuration
The API supports CORS with the following configuration:Rate Limiting
Currently, the API does not enforce rate limiting. However, it’s recommended to:- Implement request throttling in production
- Use connection pooling for database queries
- Cache frequently accessed data
Common Query Optimizations
The API uses Django ORM optimizations to reduce database queries:WebSocket Support
For real-time updates, the system uses polling-based progress tracking:Error Handling
The API implements comprehensive error handling:Async Task Processing
Long-running operations use Celery for background processing:Next Steps
Authentication
Learn how to authenticate API requests
Assets API
Explore asset management endpoints
Maintenance API
Work with maintenance operations
Documents API
Manage documents and search