API Reference

Groups

Groups are user created list of outlets. Outlets are designated by user. Groups can be used to manage sets of equipment together.

Endpoints

GET    /api/groups                       Returns list of all outlet groups
POST   /api/groups                       Creates a group of outlets.   
PUT    /api/groups/:group_id             Modifies individual group
DELETE /api/groups/:group_id             Permanently remove group.

Group Object

{
  "groupName": "Modem/Router Equipment",
  "id": "1",
  "groupRebootSequenceDelay": 3,
  "outlets": [
    {
      "outletName": "Outlet 20",
      "id": "20-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 8,
      "currentRms": 0,
      "state": "On",
      "bankId": 572662306,
      "watts": 0
    },
    {
      "outletName": "Outlet 21",
      "id": "21-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 9,
      "currentRms": 4.20,
      "state": "On",
      "bankId": 572662306,
      "watts": 5.04
    },
    ...
  ]
}
KeyTypeDescription
groupNamestringUser defined name for group
idstringUnique Identifier for Group
groupRebootSequenceDelaynumberWhen rebooting group of outlets, number of seconds to wait before each outlet turns on
outletsarrayArray of Outlet Objects


Get List of Groups

Returns a list of all groups that have been created.

GET    /api/groups       Returns list of all outlet groups

Example Request

curl 'http://192.168.1.100/api/groups' \
  --header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k'

Response

Expected response is an array of Group Objects

{
  "groupName": "Modem/Router Equipment",
  "id": "1",
  "groupRebootSequenceDelay": 3,
  "outlets": [
    {
      "outletName": "Outlet 20",
      "id": "20-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 8,
      "currentRms": 0,
      "state": "On",
      "bankId": 572662306,
      "watts": 0
    },
    {
      "outletName": "Outlet 21",
      "id": "21-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 9,
      "currentRms": 4.20,
      "state": "On",
      "bankId": 572662306,
      "watts": 5.04
    },
    ...
  ]
}

Create Group

POST   /api/groups         Creates a group of outlets.            

Request

Follows Authentication Scheme.

{
  "groupName": "Example Group 1", // required
  "outlets": ["2-858993459", "7-858993459"] // required
}

groupName required
Name string up to 100 characters

outlets optional
Outlets array of outlet UUIDs. Required at least 1.

groupRebootSequenceDelay optional
Sequence delay in seconds. When group outlets reboot, they boot consecutively and with this sequence delay. Maximum group reboot sequence delay is 99 seconds.

Example Request

curl 'http://192.168.1.100/api/groups' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"groupName":"Example Group 1","outlets":["2-858993459","7-858993459"]}'

Response

Expected response is the newly created Group Object with new group uuid.

{
  "groupName": "Modem/Router Equipment",
  "id": "2",
  "groupRebootSequenceDelay": 3,
  "outlets": [
    {
      "outletName": "Outlet 20",
      "id": "20-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 8,
      "currentRms": 0,
      "state": "On",
      "bankId": 572662306,
      "watts": 0
    },
    {
      "outletName": "Outlet 21",
      "id": "21-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 9,
      "currentRms": 4.20,
      "state": "On",
      "bankId": 572662306,
      "watts": 5.04
    },
    ...
  ]
}

Modify Group

PUT    /api/groups/:group_id           Modifies individual group

Request

Follows Authentication Scheme.
To modify the outlets inside of group, update the outlet array of outlet UUIDs. :group_id is to be replaced by Group UUID

{
  "groupName": "Storage Equipment 2",
  "outlets": ["7-858993459", "8-858993459", "3-858993459"]
}
Example Request
curl 'http://192.168.1.100/api/groups/0u912084N12dM5b05GU' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"groupName":"Storage Equipment 2","outlets":["7-858993459","8-858993459","2-858993459"]}'

Response

Expected response is a Group Object

{
  "groupName": "Modem/Router Equipment",
  "id": "2",
  "groupRebootSequenceDelay": 3,
  "outlets": [
    {
      "outletName": "Outlet 20",
      "id": "20-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 8,
      "currentRms": 0,
      "state": "On",
      "bankId": 572662306,
      "watts": 0
    },
    {
      "outletName": "Outlet 21",
      "id": "21-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 9,
      "currentRms": 4.203895392974451e-44,
      "state": "On",
      "bankId": 572662306,
      "watts": 5.048878302815963e-42
    }...
  ]
}

Switch Group Outlets

PUT /api/groups/:group_id Modify (switch) a group

Request

Follows Authentication Scheme.
To change the outlet states, use the key value state, and it's options: "ON", "OFF", "REBOOT"

{
  "state": "OFF"
}
Example Request
curl 'http://192.168.1.100/api/groups/0u912084N12dM5b05GU' \
--header 'Authorization: Bearer j2d36cG2ciHKDDqFc3k' \
--data '{"state": "OFF"}'

Response

Expected response is a Group Object

{
  "groupName": "Modem/Router Equipment",
  "id": "2",
  "groupRebootSequenceDelay": 3,
  "outlets": [
    {
      "outletName": "Outlet 20",
      "id": "20-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 8,
      "currentRms": 0,
      "state": "OFF",
      "bankId": 572662306,
      "watts": 0
    },
    {
      "outletName": "Outlet 21",
      "id": "21-572662306",
      "pwrOnState": "PREV",
      "outletIndex": 9,
      "currentRms": 4.203895392974451e-44,
      "state": "OFF",
      "bankId": 572662306,
      "watts": 5.048878302815963e-42
    }...
  ]
}

Remove a Group

DELETE /api/groups/:group_id    Permanently remove group.

Request

Follows Authentication Scheme
:group_id should be replaced with Group UUID

{} // no request parameters
Example Request
curl -X DELETE 'http://192.168.1.100/api/groups/0u912084N12dM5b05GU' \
--header 'Cookie: SPID=j2d36cG2ciHKDDqFc3k'

Response

Expected Response is a 200 HTTP Response code for successful permanent deletion of group.
 

200