Sensaphone.net API/calllist

From Sensaphone.net
Jump to: navigation, search

Sensaphone.net API

Specifications

A call list is a combination of contactgroups, users, contacts within one or more tiers (or, time waits after alarm delivery initiates). They are always contained in one or more alarm schedules. Named call lists can act as templates to be added to various call lists. An unnamed call list is considered bound to the specific alarm schedule that contains it. If a named call list is used in multiple alarm schedules, than any modification to that call list take effect in every alarm schedule that uses it.

Call Lists give users a quick and easy way to add recurring Alarm Schedules to their devices. If the same Alarm Schedule is desired to be used recurrently, Call Lists provides a means to name and save a template to be used for other devices. This will allow a user to quickly add a Call List template to the Alarm Schedule instead of adding the same Contacts, Destinations, and/or Contact Groups for every device. The structure of a Call Lists is similar to that of an Alarm Schedule with the exception that you can name and save a Call List to be used again at a later time.

The call list resource has the following properties:

Parent PropertyProperty Type Description Create Delete Read Update
<parent> calllist Array of Objects The call list object n/a
calllist list_id Integer ID of the call list.
calllist name String The name of the call list, or ""
calllist tiers Array The tiers contained in this call list.
tiers tier_id Integer The tier number (in minutes)
tiers seqential Boolean 'true' if the actions in the tier are processed sequentially.
tiers actions Array of Objects The actions in the call list n/a
actions action_id Integer The ID of the action
actions order Integer The order of delivery if sequential delivery is enabled. Lower numbers go first.
actions type String One of "user", "contact", or "group".
actions user Object The ID of the user. 'null' for none.
actions contact Object The ID of the contact. 'null' for none.
actions group Object The ID of the group. 'null' for none.
calllist new_timeranges Array A special CREATE only property for call_lists under an alarm schedule

GET

URI Mode Request URI's:

  • Retrieve all the named call lists (those that are templates).
  GET https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/
  • Retrieve the list of tiers in a specific call list.
  GET https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/tiers

JSON Mode Request URI:

  POST https://rest.sesnaphone.net/api/v1/calllist/

JSON Mode Request Properties

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

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  calllist Required Array of Objects The parent object.
calllist list_id Optional Integer ID of call list
calllist name Optional String The name of the call list, or ""
calllist tiers Optional Array The tiers contained in this call list.
tiers tier_id Optional Integer The tier number (in minutes)
tiers seqential Optional Boolean 'true' if the actions in the tier are processed sequentially.
tiers actions Optional Array of Objects The actions in the call list
actions action_id Optional Integer The ID of the action
actions order Optional Integer The order of delivery if sequential delivery is enabled. Lower numbers go first.
actions type Optional String One of "user", "contact", or "group".
actions user Optional Object The ID of the user. 'null' for none.
actions contact Optional Object The ID of the contact. 'null' for none.
actions group Optional Object The ID of the group. 'null' for none.

Example JSON

Retrieve the information for a call list.

  • Request JSON:
 {
  "acctid": 987654,
  "session": "0123-4567-8901",
  "request_type": "read",
  "calllist": [
    { "list_id": 7767 }
  ]
 }
  • Response JSON:
{
  "result":
  {
    "success": true,
    "code: 0,
    "message": "OK",
  }
  "response":
  {
    "calllist":[
     {
       "list_id": 7767,
       "name": "Primary Team",
       "tiers":[ 
         {
           "tier_id": 3645,
           "sequential": false,
           "actions":[
             {
               "action_id": 8222,
               "order": 1,
               "type": "user",
               "user":  4541 ,
               "contact": null,
               "contactgroup": null,
             },
             {
               "action_id": 8246,
               "order": 2,
               "type": "contact",
               "user": null,
               "contact": 6646,
               "contactgroup": null,
             }
           ]
         }
       ]
     }
    ]
  }
}

PUT

Tiers and Actions can only be updated in Json Mode

URI Mode Request URI's:

  • Change the name of the call list. Setting this to anything but the blank string will make the call list a template.
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/name/{NAME}
  • Change a tier in the call list to a new time offset.
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/tiers/{TIER_ID}/tier_id/{NEW_TIER_ID}

JSON Mode Request URI:

  POST https://rest.sesnaphone.net/api/v1/calllist/
  • Move a tier to a different time
 POST https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/device
 {
   "request_type" : "update",
   "device": [
     {
       "default_schedule": {
         "calllist": [
           {
             "list_id": 1234,
             "tiers": [
               {
                 "tier_id": 20,
                 "minutes" : 25
               }
             ]
           }
         ],
         "schedule_id": 1324
       },
       "device_id": 1234
     }
   ]
 }

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "update"
  calllist Array of Objects The call list object.
calllist list_id Integer ID of call list
calllist CHILD PROPERTY   Child properties to be edited*

* One or more calllist child properties listed below are required in addition to "list_id".

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  calllist Required Array of Objects The parent object.
calllist list_id Optional Integer ID of call list
calllist name Optional String The name of the call list, or ""
calllist tiers Optional Array The tiers contained in this call list.
tiers tier_id Optional Integer The tier number (in minutes)
tiers seqential Optional Boolean 'true' if the actions in the tier are processed sequentially.
tiers actions Optional Array of Objects The actions in the call list
actions action_id Optional Integer The ID of the action
actions order Optional Integer The order of delivery if sequential delivery is enabled. Lower numbers go first.
actions type Optional String One of "user", "contact", or "group".
actions user Optional Object The ID of the user. 'null' for none.
actions contact Optional Object The ID of the contact. 'null' for none.
actions group Optional Object The ID of the group. 'null' for none.

POST

Actions can only be created in Json Mode URI Mode Request URI's:

  • Create a new call list. The name must be provided.
  POST https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/name/{NAME}
  • Create a new tier in the call list.
  POST https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/tiers/minutes/{TIER_ID}/

JSON Mode Request URI:

  POST https://rest.sesnaphone.net/api/v1/calllist/
  • Create an Action
 POST https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/device/
 {
   "request_type" : "create",
   "device": [
     {
       "default_schedule": {
         "calllist": [
           {
             "list_id": 1234,
             "tiers": [
               {
                 "tier_id": 20,
                 "actions" : [ {
                         "user" : 12345
                  } ]
               }
             ]
           }
         ],
         "schedule_id": 1234
       },
       "device_id": 1234
     }
   ]
 }
  • Link a Call List to a set of TimeRanges under an Alarm Schedule
 POST https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/device/
 {
   "request_type" : "create",
   "device": [
   {
     "device_id": 1234,
     "default_schedule": {
       "schedule_id": 5678,
       "calllist": [
         {
           "list_id": 90123,
           "new_timeranges": [
             {
               "start": 32166000,
               "end": 32191200,
               "interval": 2
             }
           ]
         }
       ]
     }
   }
 ]
 }

JSON Mode Request Properties

Create a new call list.
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  calllist Array of Objects The call list object.
calllist name String The name of the call list, or ""
Create a new action.
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  calllist Array of Objects The call list object.
calllist list_id Integer ID of call list
calllist tiers Array The tiers contained in this call list.
tiers tier_id Integer The tier number (in minutes)
tiers actions Array of Objects The actions in the call list
actions user Object The ID of the contact. 'null' for none.

DELETE

URI Mode Request URI's:

  • Delete a call list. Only named call lists can be deleted.
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}
  • Delete a tier in the call list.
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/tiers/{TIER_ID}
  • Delete a user action in the call list's tier.
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{UUID}/calllist/{LIST_ID}/tiers/{TIER_ID}/actions/{ACTION_ID}/user/{USER_ID}

JSON Mode Request URI:

  POST https://rest.sesnaphone.net/api/v1/calllist/

JSON Mode Request Properties

Delete a call list.
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  calllist Array of Objects The call list object.
calllist list_id Integer ID of call list
calllist name String The name of the call list, or ""
Delete a tier.
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  calllist Array of Objects The call list object.
calllist list_id Integer ID of call list
calllist tiers Array The tiers contained in this call list.
tiers tier_id Integer The tier number (in minutes)
tiers actions Array of Objects The actions in the call list
actions user Object The ID of the contact. 'null' for none.
Delete a user action.
Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  calllist Array of Objects The call list object.
calllist list_id Integer ID of call list
calllist tiers Array The tiers contained in this call list.
tiers tier_id Integer The tier number (in minutes)
tiers actions Array of Objects The actions in the call list
actions user Object The ID of the contact. 'null' for none.