Events are specific triggers that will run specified actions. An example event would be an outlet current draw being greater than 5 amps, aith an example action being sending an email to your destination of choice.
Endpoints
GET /api/events Gets a list of all events
POST /api/events Create new event
POST /api/events/:event_id Modify existing event
DELETE /api/events/:event_id Remove event
Event Object
{
"name": "16A Warning Threshold for Banks/Circuit Breaker",
"id": 2,
"enabled": true,
"code": 31,
"numTicksBeyond": 0,
"triggered": false,
"params": [
"any",
"16",
"10"
],
"actions": [
1,
2
]
}| Key | Type | Description |
|---|---|---|
| name | string | Name for event |
| id | number | Unique identifier |
| enabled | boolean | Enable or disable event trigger |
| code | number | Event Code. see Event Codes Table |
| params | array | Array of strings for associated to particular event code. See event codes table. |
| actions | array | Array of action ID's |
| triggered | boolean | Describes whether or not the trigger has met it's threshold |
| numTicksBeyond | number | Number of steps beyond the threshold. For example, 3 ticks beyond for max current is 3 seconds beyond |
List All Events
GET /api/events Returns list of eventsExample Request
curl 'http://192.168.1.100/api/events' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k'Expected response is an array of Event Objects
Create New Event
POST /api/events Create a new EventRequest
Follows Authentication Scheme
{
"name": "Outlet #2 Amperage Threshold",
"code": 45,
"params": [
"8-286331153",
"5",
"3"
],
"actions": [
2
]
}name required
Name string up to 100 characters
code required
Event code for particular trigger. See Event Code Table.
params required for certain triggers
See Event Code Table. Array of strings, maximum 3 parameters.
actions required
Array of action ID's.
Example Request
curl 'http://192.168.1.100/api/events' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"name":"Outlet #2 Amperage Threshold","code":"45","params":["8-286331153",5,3],"actions":[2]}'Expected response is an Event Object
Modify Event
POST /api/events/:event_id Modifies specific eventRequest
Follows Authentication Scheme
{
"name": "Outlet #2 Amperage Threshold",
"code": 45,
"params": [
"8-286331153",
"5",
"3"
],
"actions": [
2
]
}Same request body as Creating New Events
Example Request
curl 'http://192.168.1.100/api/events/1' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"name":"Outlet #2 Amperage Threshold","code":"45","params":["8-286331153","6","3"],"actions":[2]}'Expected response is an Event Object
Delete Event Permanently
DELETE /api/events/:event_id Permanently remove eventRequest
Follows Authentication Scheme
{} // no request parametersExample Request
curl -X DELETE 'http://192.168.1.100/api/events/1' \
--header 'Cookie: SPID=j2d36cG2ciHKDDqFc3k'Response
Expected response is a 200 HTTP response for success.
200