API Documentation

Device Management API

GET/devices
List of User Devices

Retrieve all devices associated with the authenticated user.

Use Case: Display registered devices on dashboard.

GET/devices/add
Add New Device Form

Returns form to add a new device (name, type, config).

Use Case: Navigate to “Add Device” screen.

POST/devices/add
Add New Device

Submits new device data to register it.

Use Case: Save a newly added device.

GET/devices/edit/:id
Edit Device Form

Fetches form to edit a device’s details.

Use Case: Display current settings for editing.

POST/devices/edit/:id
Update Device Details

Updates the device’s details with submitted data.

Use Case: Save changes to an existing device.

POST/devices/delete/:id
Delete Device

Removes a device by its ID.

Use Case: Delete unused devices.

GET/devices/heartbeat/:id
Monitor Device Heartbeat

Checks a device’s heartbeat status.

Use Case: Verify device is active.

GET/devices/alert/:id
Send Device Alert

Gets alert on the device.

Use Case: Test alert mechanism.

POST/devices/alert/:id
Trigger Device Alert

Sends an alert based on conditions.

Use Case: Automated alerts from rules engine.

POST/devices/test/:id
Test Alert Function

Runs a test of the alert system.

Use Case: Verify alert setup is working.

POST/devices/reset/:id
Reset Device Alarms

Clears all active alarms on a device.

Use Case: Reset after issue resolution.

GET/api/status
Check API Health

Returns a simple status message indicating the API is up and running.

Use Case: Automated monitoring or health-check scripts.

POST/api/login
API User Login

Authenticates a user and returns a session token.

Use Case: Logging in via external applications.

Body: { "username": "...", "password": "..." }

POST/api/register
API User Registration

Creates a new user account.

Use Case: Allow third-party apps to onboard users.

Body: { "username": "...", "password": "..." }

POST/api/logout
API User Logout

Invalidates the user’s session token.

Use Case: Securely ending sessions from API clients.

GET/api/devices
Get All User Devices

Lists all devices linked to the authenticated user.

Use Case: External dashboards or scripts.

POST/api/devices/add
Add a New Device

Registers a new device for the user.

Use Case: Programmatically add devices.

POST/api/devices/edit/:id
Update Device Details

Modifies details of a specific device.

Use Case: Automated device configuration updates.

POST/api/devices/delete/:id
Delete Device

Removes a device by ID.

Use Case: Cleanup unused devices.

POST/api/devices/heartbeat/:id
Receive Heartbeat Signal

Logs a heartbeat from a device.

Use Case: Device health monitoring.

POST/api/devices/alert/:id
Trigger Device Alert

Sends a manual alert to a device.

Use Case: External alert integrations.

POST/api/devices/reset/:id
Reset Device Alarms

Clears active alarms for a device.

Use Case: Automated alarm resets after issues resolved.

Log Management API

GET/logs/heartbeat
View Heartbeat Logs

Retrieve all heartbeat events from monitored devices, including timestamp, device ID, and status.

Use Case: Audit device uptime and connectivity history.

GET/logs/alerts
View Alert Logs

Fetch a log of all triggered alerts, showing alert type, device ID, timestamp, and message.

Use Case: Diagnose past alerts for troubleshooting or compliance.

GET/logs/device/:id
View Specific Device Logs

Retrieve combined heartbeat and alert logs for one device, identified by ID.

Use Case: Analyze the full event history of a particular device.

Error Handling API

GET/404
Page Not Found

Returns a custom 404 page when the requested resource does not exist.

Use Case: Inform users they’ve navigated to an invalid URL.

GET/500
Internal Server Error

Displays a 500 error page when an unexpected server error occurs.

Use Case: Notify users of server-side failures and next steps.

GET/403
Access Denied

Shows a 403 page when the user lacks permission to view a resource.

Use Case: Prevent unauthorized access to restricted pages.