Sensaphone.net API/timerange

From Sensaphone.net
Jump to: navigation, search

Sensaphone.net API

Specifications

The schedule resource has the following properties:

Parent PropertyProperty Type Description Create Delete Read Update
<parent> timerange Array of Objects The schedule's time ranges n/a
timerange range_id Integer ID of the time range.
timerange start String The start time
timerange end String The end time
timerange interval Integer (Bitmap) Time interval options (see table)

The interval is a bitmap containing the following options. "Bit 1" is the low-order bit in the interval unsigned integer. The default value "Sunday + Monday + Tuesday + Wednesday + Thursday + Friday + Saturday", matches every day that matches the "start" and "end".

Bit Position Description
1 Timestamp: Sunday
2 Timestamp: Monday
3 Timestamp: Tuesday
4 Timestamp: Wednesday
5 Timestamp: Thursday
6 Timestamp: Friday
7 Timestamp: Saturday
8 Datetime: Is a holiday
9 Datetime: Interpret "start" and "end" as a datetime not a timestamp.
10 Datetime: Repeat: Daily
11 Datetime: Repeat: Weekly
12 Datetime: Repeat: Yearly (Day Number)
13 Datetime: Repeat: Yearly (Day of Week)
14 Invert selection. The timerange represents a time NOT selected.
15 Reserved

GET

URI Mode Request URI's:

  • Retrieve all information for all of a schedule's timeranges.
  GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/user/{USER_ID}/contact/{CONTACT_ID}/schedule/{SCHEDULE_ID}/timerange

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/user/contact/schedule/timerange

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "read"
  <parent object(s)> Array of Objects The parent(s) of the "timerange" resource, if any. See the list.
<parent> timerange Array of Objects The timerange object

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  <parent object(s)> Optional Array of Objects The parent(s) specified in the request.
<parent> timerange Required Array of Objects The timerange object
timerange range_id Optional Integer ID for timerange
timerange start Optional String The start time
timerange end Optional String The end time
timerange interval Optional Integer (Bitmap) Time interval options (see table)

Example JSON

Retrieve time range information.

  • Request JSON
  {
    "acctid": 987654,
    "uuid": "0123-4567-8901",
    "request_type": "read",
    "device":[
     {
       "device_id": 1234,
       "default_schedule":[
        {
          "schedule_id":28487,
          "timerange": null
        }
       ]
     }
    ]
  }
  • Response JSON
{
  "result":
  {
    "success": true,
    "code": 0,
    "message": "OK"
  },
  "response":
  {
    "device":[
     {
       "device_id": 1234,
       "default_schedule":[
        {
          "schedule_id":28487,
          "timerange":[
            {
              "range_id": 58381
              "start": "..TBD..",
              "end": "..TBD..",
              "interval": 127
            },
            {
              "range_id": 51587
              "start": "..TBD..",
              "end": "..TBD..",
              "interval": 7
            }
          ]
        }
       ]
     }
    ]
  }
}

PUT

URI Mode Request URI's

  • Edit the interval of a time range
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/default_schedule/{SCHEDULE_ID}/timerange/{RANGE_ID}/interval/{INTERVAL}

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/device/default_schedule/timerange

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "update"
  <parent object(s)> Array of Objects The parent(s) of the "timerange" resource, if any. See the list.
<parent> timerange Array of Objects The timerange object
timerange range_id Integer ID for time range
timerange CHILD PROPERTY   Child properties to be edited *

* One or more timerange child properties listed below are required in addition to "range_id".

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  <parent object(s)> Optional Array of Objects The parent(s) specified in the request.
<parent> timerange Required Array of Objects The timerange object
timerange range_id Optional Integer ID for timerange
timerange start Optional String The start time
timerange end Optional String The end time
timerange interval Optional Integer (Bitmap) Time interval options (see table)

POST

URI Mode Request URI's

  • Create a new time range with default values.
  POST https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/default_schedule/{SCHEDULE_ID}/timerange

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/device/default_schedule/timerange

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "create"
  <parent object(s)> Array of Objects The parent(s) of the "timerange" resource, if any. See the list.
<parent> timerange Array of Objects The timerange object
timerange CHILD PROPERTY   Child properties to be set *

* One or more timerange child properties below may be specified in addition to "range_id".

JSON Mode Response Properties

Parent PropertyChild PropertyStatus Type Description
  <parent object(s)> Optional Array of Objects The parent(s) specified in the request.
<parent> timerange Required Array of Objects The timerange object
timerange range_id Optional Integer ID for timerange
timerange start Optional String The start time
timerange end Optional String The end time
timerange interval Optional Integer (Bitmap) Time interval options (see table)


DELETE

URI Mode Request URI's

  • Create a new time range with default values.
  DELETE https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/default_schedule/{SCHEDULE_ID}/timerange/{RANGE_ID}

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/device/default_schedule/timerange

JSON Mode Request Properties

Parent PropertyChild PropertyType Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "delete"
  <parent object(s)> Array of Objects The parent(s) of the "timerange" resource, if any. See the list.
<parent> timerange Array of Objects The timerange object
timerange range_id Integer ID for time range