Operations - active911/open-api GitHub Wiki
The following nouns may be passed to the operation=
POST parameter:
Get Device (operation=get_device)
Description
Returns details about a specific device (someone's phone, tablet, or PC).
Parameters
Parameter | Type | Example | Description |
---|---|---|---|
operation | string | get_device | Required |
device_id | int | 2435 | ID of the device you are querying |
Example Response
{
"message" : {
"response_action" : "watch",
"response_alert_id" : 4681099,
"lat" : 44.541404,
"name" : "Joseph Sullivan",
"position_accuracy" : 30,
"response_stamp" : 1371315741,
"device_id" : 2435,
"position_stamp" : 1371463606,
"device_type" : "smartphone",
"lon" : -123.364192
},
"result" : "success"
}
Most of the parameters are fairly self explanatory. position_accuracy
is in meters, and the position_stamp
and response_stamp
numbers are Unix timestamps (UTC) from the last know position and response actions. response_alert_id
is the alert_id affiliated with the response_action. In the example above, device 2435 (Joseph Sullivan) went "watching" on alert ID 4681099 at 1371315741 (which is Sat, 15 Jun 2013 17:02:21 GMT).
Get Alert (operation=get_alert)
Description
Returns details about a specific alert.
Parameters
Parameter | Type | Example | Description |
---|---|---|---|
operation | string | get_alert | Required |
alert_id | int | 1002034 | ID of the alert you are querying |
Example Response
{
"message" : {
"source" : "",
"priority" : "F3",
"cad_code" : "",
"lat" : 44.5379997,
"place" : "",
"agency_id" : 3,
"state" : "OR",
"map_code" : "",
"city" : "Philomath",
"timestamp" : 1369781684,
"address" : "100 S. 16th ST",
"description" : "Cat in tree",
"details" : "",
"unit" : "",
"lon" : -123.3634479,
"cross_street" : "",
"alert_id" : 4264162,
"units" : ""
},
"result" : "success"
}
As with get_device, most of the parameters are fairly self explanatory. lat and lon are the geocoded coordinates of the alert, or the coordinates given to Active911 at the time of the alert creation (this is dependent on account settings). Once again, timestamps are UNIX timestamps.
Get Locations (operation=get_locations)
Description
Returns Map Data and associated resources for the specified region.
Parameters
Parameter | Type | Example | Description |
---|---|---|---|
operation | string | get_locations | Required |
north | float | 46.12345 | North latitude of bounding box |
south | float | 44.54321 | South latitude of bounding box |
east | float | -122.00021 | East longitude of bounding box |
west | float | -124.132132 | West longitude of bounding box |
Example Response
{
"message" : {
"locations" : [
{
"resources" : [],
"lat" : 44.540121,
"name" : "Pinehurst Memorial",
"agency_id" : 3,
"icon_filename" : "icon-flag.png",
"description" : "Main Station Hosp.\nNear the depot\n5 entrances",
"id" : 175,
"lon" : -123.367601,
"icon_color" : "blue"
},
{
"resources" : [
{
"extension" : "jpg",
"title" : "Photo",
"id" : 5,
"details" : "",
"size" : 963979
}
],
"lat" : 44.541252,
"name" : "Hydrant",
"agency_id" : 3,
"icon_filename" : "icon-hydrant.png",
"description" : "15th & College",
"id" : 700,
"lon" : -123.364689,
"icon_color" : "red"
}
]
},
"result" : "success"
}
In this example, two Map Data markers are returned. The first one has no attached resources, but the second one has as JPEG image attachment. The JPEG, titled "Photo", is identified as resource ID 5. This resource identifier will be needed in order to retrieve the actual JPEG data.