Sensaphone.net API/coordinates

From Sensaphone.net
Revision as of 08:01, 19 June 2015 by Tim (Talk | contribs) (Specifications)

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

Sensaphone.net API

Specifications

The coordinates object holds latitude and longitude coordinates. It is not an individual (top-level) API resource, but is instead used in conjunction with other resources (e.g. devices).

The coordinates resource has the following properties:

Parent PropertyProperty Type Description Create Delete Read Update
<parent> coordinates Object The coordinates object. n/a
coordinates coordinates_id Integer ID of the address.
coordinates lng Floating Point Longitude
coordinates lat Floating Point Latitude
coordinates cached Boolean Are coordinates from geocoding cache

GET

URI Mode Request URI's:

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

JSON Mode Request URI:

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

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> coordinates Array of Objects The coordinates 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> coordinates Required Array of Objects Address data
coordinates coordinates_id Required Integer ID of the address.
coordinates lng Optional Floating Point Longitude
coordinates lat Optional Floating Point Latitude
coordinates cached Optional Boolean Are coordinates from geocoding cache

Example JSON

Receive coordinates for a device.

  • Request JSON:
{
  "acctid": 987654,
  "sessionid": "0123-4567-8901",
  "request_type": "read",
  "device":[
  {
    "device_id": 1234,
    "coordinates": null
  }
}
  • Response JSON
{
  "result":
  {
    "success": true,
    "code": 0,
    "message": "OK"
  },
  "response":
  {
    "device":[
     {
       "device_id": 1234,
       "coordinates":[
        {
          "coordinates_id": 28487,
          "lat": 39.868809,
          "lng": -75.674508
        }
       ]
     }
    ]
  }
}

PUT

URI Mode Request URI's:

  • Edit the coordinates's latitude coordinate.
  PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SEESIONID}/device/{DEVICE_ID}/coordinates/lat/{LATITUDE}

JSON Mode Request URI:

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

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> coordinates Array of Objects The coordinates object
coordinates CHILD PROPERTY   Coordinate's child properties to be edited*

*One or more coordinates child properties listed below is required (other than "coordinates_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> coordinates Required Array of Objects Address data
coordinates coordinates_id Required Integer ID of the address.
coordinates lng Optional Floating Point Longitude
coordinates lat Optional Floating Point Latitude