Sensaphone.net API/devicegroup

From Sensaphone.net
Revision as of 14:12, 29 April 2015 by Tim (Talk | contribs) (Created page with "=Sensaphone.net API= Sensaphone.net includes a feature to group individual devices together. The DeviceGroup API allows a user to view and edit grouping information. ==S...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Sensaphone.net API

Sensaphone.net includes a feature to group individual devices together. The DeviceGroup API allows a user to view and edit grouping information.

Specifications

The device group resource has the following properties:

Parent Property Property Type Description Create Delete Read Update
<parent> devicegroup Object The devicegroup object. n/a
devicegroup group_id Integer ID of the device group.
devicegroup name String The name of this group.
devicegroup devices Array of Objects The list of devices in this group.
devices device_id Integer The device_id of a device that is a member of this group.
devicegroup groups Array of Objects The list of groups in this group.
groups group_id Integer The group_id of a group that is a member of this group.

GET

URI Mode Request URI's:

  • Receive all Device Group information
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup
  • Receive all Device Group names
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/name
  • Receive all Device ID's in a Device Group
GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/devices/device_id

JSON Mode Request URI:

POST https://rest.sensaphone.net/api/v1/devicegroup

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "read"
  devicegroup Array of Objects The devicegroup object.

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  devicegroup Required Array of Objects The parent device object.
devicegroup group_id Optional Integer ID of Device Group
devicegroup name Optional String The name of this group.
devicegroup devices Optional Array of Objects The list of devices in this group.
devices device_id Optional Integer The device_id of a device that is a member of this group.
devicegroup groups Optional Array of Objects The list of groups in this group.
groups group_id Optional Integer The group_id of a group that is a member of this group.

Example JSON

Receive all Device Group information

  • Request JSON:
 {
  "acctid": 987654,
  "session": "0123-4567-8901",
  "request_type": "read",
  "devicegroup": null
 }
  • Response JSON:
{
  "result":
  {
    "success": true,
    "code: 0,
    "message": "OK",
  }
  "response":
  {
    "devicegroup":[
     {
       "group_id": 6575,
       "name": "South Barns",
       "devices":
       [ 
         { "device_id": 1234 },
         { "device_id": 1235 }
       ],
       "groups":
       [
         { "group_id": 8575 },
         { "group_id": 8404 }
       ]
     }
    ]
  }
}

PUT

The PUT request for the device group resource is used to edit the group:

  • Change the name
  • Add or remove devices (JSON mode only)
  • Add or remove groups (JSON mode only)

URI Mode Request URI:

  • Edit a Device Group name
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/name/{GROUP_NAME} 

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/devicegroup

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "update"
  devicegroup Array of Objects The devicegroup object.
devicegroup group_id Integer ID of the device group.
devicegroup group_name String New name of a Device Group

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  devicegroup Required Array of Objects The parent device object.
devicegroup group_id Optional Integer ID of Device
devicegroup name Optional String The name of this group.
devicegroup devices Optional Array of Objects The list of devices in this group.
devices device_id Optional Integer The device_id of a device that is a member of this group.
devicegroup groups Optional Array of Objects The list of groups in this group.
groups group_id Optional Integer The group_id of a group that is a member of this group.

POST

URI Mode Request URI's:

  • Create a new empty Device Group (A group_name value is required when creating a new Device Group)
 POST  https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/name/{GROUP_NAME}
  • Add a device to a device group
 POST https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/devices/device_id/{DEVICE_ID}
  • Add a group to a device group
 POST https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/groups/group_id/{GROUP_ID}

JSON Mode Request URI:

 POST  https://rest.sensaphon.net/api/v1/devicegroups

JSON Mode Request Properties

Create new device group
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  devicegroup Array of Objects The devicegroup object.
devicegroup name String New name of a Device Group.
Add device and/or group
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  devicegroup Array of Objects The devicegroup object.
devicegroup group_id Integer ID of Device
devicegroup devices Array of Objects Used to add devices to the group.
devices device_id Integer The device_id of a device to add to this group.
devicegroup groups Array of Object Used to add groups to the group.
groups group_id Integer The group_id of a group to add to this group.

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  devicegroup Required Array of Objects The parent device object.
devicegroup group_id Optional Integer ID of Device
devicegroup name Optional String The name of this group.
devicegroup devices Optional Array of Objects The list of devices in this group.
devices device_id Optional Integer The device_id of a device that is a member of this group.
devicegroup groups Optional Array of Objects The list of groups in this group.
groups group_id Optional Integer The group_id of a group that is a member of this group.

DELETE

URI Mode Request URI's:

  • Delete a device group
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}
  • Delete a device from a device group
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/devices/device_id/{DEVICE_ID}
  • Delete a group from a device group
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/devicegroup/{GROUP_ID}/groups/group_id/{GROUP_ID}

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/devicegroup

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "delete"
  devicegroup Array of Objects The devicegroup object.
devicegroup group_id Integer ID of the device group.
devicegroup devices Array of Objects Used to remove devices from the group. (Optional)
devices device_id Integer The device_id of a device that is a member of this group.
devicegroup groups Array of Object Used to remove groups from the group. (Optional)
groups group_id Integer The group_id of a group that is a member of this group.