Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CspmIT/centinela-front/llms.txt

Use this file to discover all available pages before exploring further.

Introduction

The Centinela API provides programmatic access to the water treatment monitoring system. It enables you to manage variables, alarms, charts, diagrams, and user configurations for your water treatment facilities.

Base URL

The API base URL depends on your environment:
http://localhost:4000/api

API Architecture

The Centinela API follows RESTful principles and uses:
  • JSON for request and response payloads
  • Bearer token authentication
  • Standard HTTP methods (GET, POST, PUT, DELETE)
  • HTTP status codes for response indication

Common Response Formats

Success Response

{
  "data": {
    // Response data here
  }
}

Error Response

{
  "error": {
    "message": "Error description"
  }
}

HTTP Status Codes

The API uses standard HTTP status codes:
Status CodeDescription
200Success - Request completed successfully
201Created - Resource created successfully
400Bad Request - Invalid request parameters
401Unauthorized - Invalid or missing authentication
403Forbidden - Insufficient permissions
404Not Found - Resource not found
500Internal Server Error - Server-side error

Rate Limiting

Currently, the API does not enforce rate limiting. However, it’s recommended to implement reasonable polling intervals:
  • Real-time data: Poll every 30 seconds
  • Configuration data: Cache and refresh as needed
  • Bulk operations: Process in batches

Data Polling

For real-time monitoring data, the system uses periodic polling:
// Example: Poll multiple influx variables every 30 seconds
setInterval(async () => {
  const response = await fetch(`${baseUrl}/multipleDataInflux`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'Authorization': `Bearer ${token}`
    },
    body: JSON.stringify(variables)
  });
  const data = await response.json();
}, 30000);

Client Libraries

The Centinela frontend uses Axios for HTTP requests. Here’s the base request configuration:
const request = async (url, method, data = false) => {
  const response = await axios({
    method,
    url,
    data: data || {},
    withCredentials: true,
    headers: {
      'Content-Type': 'application/json',
      'Accept': 'application/json',
      'Authorization': 'Bearer ' + token
    }
  });
  return response;
};

InfluxDB Integration

Centinela integrates with InfluxDB for time-series data storage. Variables are configured with:
  • Topic: MQTT topic or data source
  • Field: Specific field within the topic
  • Time period: Query time range (ms, s, m, h, d, mo, y)
  • Sample period: Aggregation interval
  • Period type: last (instant) or mean (average)

Next Steps

Authentication

Learn how to authenticate API requests

Variables

Manage monitoring variables

Alarms

Configure and manage alarms

Charts

Create and manage visualizations

Build docs developers (and LLMs) love