User Guide¶
This section provides guidance on how to use the REST API effectively.
Getting Started¶
- Base URL: The API base URL is
/api/{APP_NAME}whereAPP_NAMEis defined in the.envfile. - Authentication: Use the
x-api-keyheader with your API key for authentication.
Request and Response Examples¶
Example: Get All Alarms¶
Request:
GET /alarm/all HTTP/1.1
Host: {BASE_URL}
Content-Type: application/json
x-api-key: {API_KEY}
Response:
{
"200": {
"description": "All alarms",
"schema": {
"type": "integer"
}
}
}
Example: Get Alarm Config Dashboards¶
Request:
GET /filters/dashboards HTTP/1.1
Host: {BASE_URL}
Content-Type: application/json
x-api-key: {API_KEY}
Response:
{
"200": {
"description": "Total dashboard filters",
"schema": {
"type": "integer"
}
}
}
Example: Create a New Interval¶
Request:
POST /intervals HTTP/1.1
Host: {BASE_URL}
Content-Type: application/json
x-api-key: {API_KEY}
{
"intervalFeedbackTestApi": 30,
"intervalDeviceStatus": 60,
"intervalDeviceStatusEspera": 120,
"intervalAllDevices": 300,
"intervalDeviceWatchers": 180,
"intervalDeviceWatchersTimeout": 240,
"intervalRefreshToken": 3600,
"intervalDeviceInternalConsult": 600,
"intervalDeviceSyncInfo": 900
}
Response:
{
"200": {
"description": "Interval created successfully"
}
}
Example: Create a New Watcher¶
Request:
POST /watcher HTTP/1.1
Host: {BASE_URL}
Content-Type: application/json
x-api-key: {API_KEY}
{
"user": "admin",
"dashboard": "controlHub",
"service": "status",
"type": "webex",
"devicesId": ["device1", "device2"],
"allDevices": false,
"severity": 1,
"operations": {
"type": "group",
"operatorType": "AND",
"conditions": [
{
"operator": "!=",
"value": "connected",
"element": "connectionStatus"
}
]
},
"description": "Alarma si está desconectado",
"sendEmail": true,
"emails": ["example@example.com"]
}
Response:
{
"200": {
"description": "Watcher",
"schema": {
"type": "integer"
}
}
}
Error Handling¶
- 400 Bad Request: Invalid input or missing parameters.
- 401 Unauthorized: Missing or invalid API key.
- 404 Not Found: Resource not found.
- 500 Internal Server Error: Server encountered an error.
Additional Notes¶
- Refer to the Watchers API, Alarms API, Filters API, Intervals API for detailed endpoint specifications.
- Ensure the
.envfile is properly configured before starting the service.