Sensaphone.net API/address

From Sensaphone.net
Jump to: navigation, search

Sensaphone.net API

Specifications

The Address object holds street address information. It is not an individual (top-level) API resource, but is instead used in conjunction with other resources in a number of contexts including devices and users. It may be used as its own entity (e.g. users) or as part of a location (e.g. devices). The "address" resource cannot be created or deleted. Because the address ID is fixed and predetermined, it is not required to access the resource, although it may be optionally specified.

The address resource has the following properties:

Parent PropertyProperty Type Description Create Delete Read Update
<parent> address Object The address object. n/a
address address_id Integer ID of the address.
address address_line_1 String First line of street address
address address_line_2 String Second line of street address
address city String City
address state String State
address zip String Zip Code
address country String Country

GET

URI Mode Request URI's:

  • Retrieve all the address data for a particular device.
  GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/address
  • Retrieve the city for a particular device's address.
  GET https://rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/address/city

JSON Mode Request URI:

  POST https://rest.sensaphone.net/api/v1/device/address

JSON Mode Request Properties

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

JSON Mode Response Properties

Parent Properties Child Property Status Type Description
  <parent object(s)> Optional Array of Objects The parent(s) specified in the request.
<parent> address Required Array of Objects Address data
address address_id Required Integer ID of the address.
address address_line_1 Optional String First line of street address
address address_line_2 Optional String Second line of street address
address city Optional String City
address state Optional String State
address zip Optional String Zip code
address country Optional String Country of address

Example JSON

Receive city value of an Address

  • Request JSON:
{
  "acctid": 987654,
  "sessionid": "0123-4567-8901",
  "request_type": "read",
  "device":[
  {
    "device_id": 1234,
    "address": [
      {
        "city": null
      }
    ]
  }
}
  • Response JSON
{
  "result":
  {
    "success": true,
    "code": 0,
    "message": "OK"
  },
  "response":
  {
    "device":[
     {
       "device_id": 1234,
       "address": [
         {
           "address_id": 13553
           "city": "Kennett Square"
         }
       ]
     }
    ]
  }
}

PUT

URI Mode Request URI's:

  • Edit the address's state
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SEESIONID}/device/{DEVICE_ID}/address/state/{STATE}

JSON Mode Request URI:

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

JSON Mode Request Properties

Parent Properties Child Properties Type Description
  acctid Integer Account ID
  session Integer Session ID
  request_type String "update"
  <parent object(s)> Array of Objects The parent(s) of the "address" resource, if any. See the list.
<parent> address Array of Objects The address object
address CHILD PROPERTY   Address's child properties to be edited*

*One or more address child properties listed below is required (other than "address_id").

JSON Mode Response Properties

Parent Properties Child Property Status Type Description
  <parent object(s)> Optional Array of Objects The parent(s) specified in the request.
<parent> address Required Array of Objects Address data
address address_id Required Integer ID of the address.
address address_line_1 Optional String First line of street address
address address_line_2 Optional String Second line of street address
address city Optional String City
address state Optional String State
address zip Optional String Zip code
address country Optional String Country of address