Documentation Index
Fetch the complete documentation index at: https://mintlify.com/CspmIT/mas-agua-front/llms.txt
Use this file to discover all available pages before exploring further.
Data & Monitoring
POST /seriesDataInflux
Retrieve time-series data from InfluxDB for chart visualization.
Array of query objects defining the data to retrieve
InfluxDB measurement name
Field to query from the measurement
Sampling interval (e.g., “5m”, “1h”, ”30s”)
import { request } from './utils/js/request';
import { backend } from './utils/routes/app.routes';
const query = [
{
measurement: 'water_flow',
field: 'flow_rate',
samplingPeriod: '5m'
}
];
const { data } = await request(
`${backend['Mas Agua']}/seriesDataInflux`,
'POST',
query
);
Object with variable IDs as keys and arrays of time/value pairs as values
{
"data": {
"var_123": [
{ "time": "01/03/26, 10:00:00 a. m.", "value": 1.65 },
{ "time": "01/03/26, 10:05:00 a. m.", "value": 1.72 },
{ "time": "01/03/26, 10:10:00 a. m.", "value": 1.58 }
]
}
}
Refer to src/modules/dashBoard/factories/chartQueryBuilderMap.js:66-70.
POST /dataInflux
Retrieve a single data point from InfluxDB for real-time values.
Variable configuration object from InfluxDB
Calculated field name to retrieve
const { data } = await request(
`${backend['Mas Agua']}/dataInflux`,
'POST',
{
calc_field: 'chlorine_level',
measurement: 'water_quality'
}
);
Object containing the current value for the requested field
{
"data": {
"chlorine_level": {
"value": 0.65
}
}
}
See src/modules/dashBoard/factories/chartQueryBuilderMap.js:149-152.
POST /multipleDataInflux
Retrieve multiple real-time data points in a single request.
Array of data objects with variable configurations
influxVarsToRequest[].dataInflux
Variable metadata including ID, name, unit, and varsInflux configuration
const influxVarsToRequest = [
{
dataInflux: {
id: 'var_1',
name: 'flow_rate',
unit: 'm3/h',
varsInflux: {
measurement: 'water_flow',
field: 'flow'
}
}
},
{
dataInflux: {
id: 'var_2',
name: 'pressure',
unit: 'bar',
varsInflux: {
measurement: 'water_pressure',
field: 'pressure'
}
}
}
];
const response = await request(
`${backend['Mas Agua']}/multipleDataInflux`,
'POST',
influxVarsToRequest
);
const values = response.data;
Object with variable IDs as keys and current values
{
"data": {
"var_1": 1.65,
"var_2": 3.2
}
}
Refer to src/modules/DrawDiagram/utils/js/drawActions.js:175-179.
Diagram Management
GET /getObjectCanva
Retrieve diagram canvas objects including lines, images, texts, and polylines.
const objectDiagram = await request(
`${backend['Mas Agua']}/getObjectCanva?id=${diagramId}`,
'GET'
).then((res) => res?.data?.[0]);
Array containing the diagram object
Background color (hex code)
Array of polyline objects
Array of image objects with associated variables
{
"data": [
{
"id": 5,
"title": "Water Treatment Plant",
"backgroundColor": "#ffffff",
"backgroundImg": "https://example.com/bg.png",
"lines": [
{
"id": 1,
"points": {
"start": { "left": 100, "top": 200 },
"end": { "left": 300, "top": 200 }
},
"stroke": "#0000ff",
"strokeWidth": 2,
"variable": {
"name": "flow_rate",
"unit": "m3/h",
"varsInflux": {...}
}
}
],
"images": [...],
"texts": [...],
"polylines": [...]
}
]
}
See src/modules/DrawDiagram/utils/js/drawActions.js:14-17.
POST /saveDiagram
Save or update a diagram with all canvas objects.
Diagram ID (omit for new diagrams)
Array of line objects to save
Array of polyline objects to save
Array of text objects to save
Array of image objects to save
Object containing arrays of deleted object IDs
const saveObjects = {
diagram: {
id: 5,
title: 'Water Treatment Plant',
status: 1,
backgroundColor: '#ffffff',
backgroundImg: ''
},
lines: [
{
id: 1,
id_influxvars: 'var_123',
points: {
start: { left: 100, top: 200 },
end: { left: 300, top: 200 }
},
stroke: '#0000ff',
strokeWidth: 2,
animation: 1,
invertAnimation: false,
status: 1
}
],
images: [],
texts: [],
polylines: [],
deleted: {
lines: [],
images: [3, 5],
texts: [],
polylines: []
}
};
await request(
`${backend['Mas Agua']}/saveDiagram`,
'POST',
saveObjects
);
Indicates if the save operation was successful
Refer to src/modules/DrawDiagram/utils/js/drawActions.js:364.
Configuration & Variables
GET /getVarsInflux
Retrieve all InfluxDB variables available for the current schema.
import { request } from './utils/js/request';
import { backend } from './utils/routes/app.routes';
const list = await request(
`${backend['Mas Agua']}/getVarsInflux`,
'GET'
);
if (list?.data) {
const variables = list.data;
// Use variables...
}
Array of variable objects with InfluxDB configuration
{
"data": [
{
"id": "var_123",
"name": "flow_rate",
"unit": "m3/h",
"type": "number",
"varsInflux": {
"measurement": "water_flow",
"field": "flow",
"calc_field": "flow_rate"
}
},
{
"id": "var_124",
"name": "pressure",
"unit": "bar",
"type": "number",
"varsInflux": {...}
}
]
}
See src/modules/DrawDiagram/components/Fields/actions.js:5-8.
GET /getConfigNotify
Retrieve notification configuration for MQTT devices.
const config = await request(
`${backend['Mas Agua']}/getConfigNotify`,
'GET'
);
const configData = config.data;
Nested object organized by device, brand, and version
{
"data": {
"Reconectador": {
"NOJA": {
"v1": [
{
"id": 1,
"id_event_influx": 100,
"alarm": true
}
]
}
}
}
}
Refer to src/modules/ConfigNotifications/utils/js/index.js:5.
POST /sendConfigMQTT
Send configuration to MQTT devices.
Configuration data to send
const topic = 'coop/energia/Reconectadores/NOJA/0310123456789/action';
const data = {
source_0: [100, 101, 102]
};
await request(
`${backend['Mas Agua']}/sendConfigMQTT`,
'POST',
{ topic, data }
);
Indicates if the MQTT message was sent successfully
See src/modules/ConfigNotifications/utils/js/index.js:68-71.
Retrieve all menu items for the application.
const menusResponse = await request(
`${backend['Mas Agua']}/getAllMenu`,
'GET'
);
const menus = menusResponse?.data || [];
Array of menu item objects
{
"data": [
{
"id": 1,
"name": "Dashboard",
"icon": "dashboard",
"path": "/dashboard",
"status": true
},
{
"id": 2,
"name": "Diagrams",
"icon": "diagram",
"path": "/diagrams",
"status": true
}
]
}
Refer to src/modules/NavBarCustom/utils/js/index.js:33.
GET /getPermission
Retrieve user or profile permissions for menu items.
Permission type: “id_user” or “id_profile”
Profile ID (when querying by user)
const usuario = storage.get('usuario');
const permissiondata = await request(
`${backend['Mas Agua']}/getPermission?id=${usuario.sub}&type=id_user&profile=${usuario.profile}`,
'GET'
);
const permissions = permissiondata?.data || [];
Array of permission objects
{
"data": [
{
"id": 28,
"id_menu": 1,
"id_profile": 4,
"id_user": null,
"status": true
},
{
"id": 112,
"id_menu": 25,
"id_profile": null,
"id_user": 6,
"status": false
}
]
}
See src/modules/NavBarCustom/utils/js/index.js:18-22.
Error Responses
All endpoints may return the following error responses:
401 Unauthorized
{
"error": {
"message": "Invalid or expired token",
"code": "UNAUTHORIZED"
}
}
500 Internal Server Error
Server errors return detailed error messages extracted from the response:
{
"error1": { "message": "Database connection failed" },
"error2": { "message": "Invalid query parameters" }
}
The client utility concatenates these into a single error message:
// Extracted error: "Database connection failed Invalid query parameters"
Rate Limits
No explicit rate limits are currently enforced, but clients should implement reasonable throttling to avoid server overload.
Next Steps
Authentication
Learn about JWT token authentication
Components
Explore chart components that use these endpoints