Sensaphone.net API/coordinates
From Sensaphone.net
Revision as of 14:14, 29 April 2015 by Tim (Talk | contribs) (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...")
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 Property | Property | Type | Description | Create | Delete | Read | Update |
<parent> | coordinates | Object | The coordinates object. | ✓ | n/a | ||
coordinates | coordinates_id | Integer | ID of the address. | ✓ | |||
coordinates | x | Floating Point | Longitude | ✓ | ✓ | ||
coordinates | y | Floating Point | Latitude | ✓ | ✓ |
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/x
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 | x | Optional | String | Longitude |
coordinates | y | Optional | String | Latitude |
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, "x": 39.868809, "y": -75.674508 } ] } ] } }
PUT
URI Mode Request URI's:
- Edit the coordinates's x (latitude) coordinate.
PUT https://rest.sensaphone.net/api/v1/{ACCTID}/{SEESIONID}/device/{DEVICE_ID}/coordinates/x/{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 | x | Optional | String | Longitude |
coordinates | y | Optional | String | Latitude |