Difference between revisions of "Sensaphone.net API/coordinates"

From Sensaphone.net
Jump to: navigation, search
(Created page with "=Sensaphone.net API= ==Specifications== The '''coordinates''' object holds latitude and longitude coordinates. It is not an individual (top-level) API resource, but is ins...")
 
(Specifications)
 
Line 8: Line 8:
 
}}{{TableRowN| ''<parent>''        | coordinates    | Object        | The coordinates object.  | ''' ''' | ''' ''' | '''&#x2713;''' | '''n/a'''
 
}}{{TableRowN| ''<parent>''        | coordinates    | Object        | The coordinates object.  | ''' ''' | ''' ''' | '''&#x2713;''' | '''n/a'''
 
}}{{TableRowN| coordinates          | coordinates_id | Integer        | ID of the address.      | ''' ''' | ''' ''' | '''&#x2713;''' | ''' '''
 
}}{{TableRowN| coordinates          | coordinates_id | Integer        | ID of the address.      | ''' ''' | ''' ''' | '''&#x2713;''' | ''' '''
}}{{TableRowN| coordinates          | x             | Floating Point |  Longitude              | ''' ''' | ''' ''' | '''&#x2713;''' | '''&#x2713;'''
+
}}{{TableRowN| coordinates          | lng             | Floating Point |  Longitude              | ''' ''' | ''' ''' | '''&#x2713;''' | '''&#x2713;'''
}}{{TableRowN| coordinates          | y             | Floating Point | Latitude                | ''' ''' | ''' ''' | '''&#x2713;''' | '''&#x2713;'''
+
}}{{TableRowN| coordinates          | lat             | Floating Point | Latitude                | ''' ''' | ''' ''' | '''&#x2713;''' | '''&#x2713;'''
 +
}}{{TableRowN| coordinates          | cached              | Boolean | Are coordinates from geocoding cache                | ''' ''' | ''' ''' | '''&#x2713;''' | ''' '''
 
}}{{TableEnd}}
 
}}{{TableEnd}}
  
Line 18: Line 19:
  
 
*Retrieve the latitude coordinate for a particular device's address.
 
*Retrieve the latitude coordinate for a particular device's address.
   '''GET''' <nowiki>https://</nowiki>rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/coordinates/x
+
   '''GET''' <nowiki>https://</nowiki>rest.sensaphone.net/api/v1/{ACCTID}/{SESSIONID}/device/{DEVICE_ID}/coordinates/lat
  
 
'''JSON Mode Request URI:'''
 
'''JSON Mode Request URI:'''
Line 39: Line 40:
 
}}{{TableRowN| ''<parent>''              | coordinates            | Required    | Array of Objects | Address data
 
}}{{TableRowN| ''<parent>''              | coordinates            | Required    | Array of Objects | Address data
 
}}{{TableRowN| coordinates              | coordinates_id          | Required    | Integer          | ID of the address.
 
}}{{TableRowN| coordinates              | coordinates_id          | Required    | Integer          | ID of the address.
}}{{TableRowN| coordinates              | x                       | Optional    | String           | Longitude
+
}}{{TableRowN| coordinates              | lng                       | Optional    | Floating Point           | Longitude
}}{{TableRowN| coordinates              | y                       | Optional    | String           | Latitude
+
}}{{TableRowN| coordinates              | lat                       | Optional    | Floating Point           | Latitude
 +
}}{{TableRowN| coordinates              | cached                      | Optional    | Boolean          | Are coordinates from geocoding cache
 
}}{{TableEnd}}
 
}}{{TableEnd}}
  
Line 74: Line 76:
 
         {
 
         {
 
           "coordinates_id": 28487,
 
           "coordinates_id": 28487,
           "x": 39.868809,
+
           "lat": 39.868809,
           "y": -75.674508
+
           "lng": -75.674508
 
         }
 
         }
 
         ]
 
         ]
Line 85: Line 87:
 
===PUT===
 
===PUT===
 
'''URI Mode Request URI's:'''
 
'''URI Mode Request URI's:'''
*Edit the coordinates's '''x''' (latitude) coordinate.
+
*Edit the coordinates's latitude coordinate.
   '''PUT''' https://rest.sensaphone.net/api/v1/{ACCTID}/{SEESIONID}/device/{DEVICE_ID}/coordinates/x/{LATITUDE}
+
   '''PUT''' https://rest.sensaphone.net/api/v1/{ACCTID}/{SEESIONID}/device/{DEVICE_ID}/coordinates/lat/{LATITUDE}
  
 
'''JSON Mode Request URI:'''
 
'''JSON Mode Request URI:'''
Line 109: Line 111:
 
}}{{TableRowN| ''<parent>''              | coordinates            | Required    | Array of Objects | Address data
 
}}{{TableRowN| ''<parent>''              | coordinates            | Required    | Array of Objects | Address data
 
}}{{TableRowN| coordinates              | coordinates_id          | Required    | Integer          | ID of the address.
 
}}{{TableRowN| coordinates              | coordinates_id          | Required    | Integer          | ID of the address.
}}{{TableRowN| coordinates              | x                       | Optional    | String           | Longitude
+
}}{{TableRowN| coordinates              | lng                       | Optional    | Floating Point           | Longitude
}}{{TableRowN| coordinates              | y                       | Optional    | String           | Latitude
+
}}{{TableRowN| coordinates              | lat                       | Optional    | Floating Point           | Latitude
 
}}{{TableEnd}}
 
}}{{TableEnd}}

Latest revision as of 08:01, 19 June 2015

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