2. Alerts Initialization
When initializing your application, you should query for the current state of all active alerts in your jurisdiction. This can be accomplished with the API requests detailed below.
2.1 Retrieve Active Alerts
This request returns all metadata for active alerts in the ECC's jurisdiction. An active alert is defined as any alert created in the last 12 hours, based on server time, regardless of status.
For ECC Integrations
Only alerts with the DISPATCH_REQUESTED, ACKNOWLEDGED, ACCEPTED, DECLINED, or TIMEOUT status will be returned.
The NEW and IGNORED statuses are specific to alerts available to Central Monitoring Stations that either have not been verified and requested for dispatch yet, or have been determined to not require emergency dispatch.
For ECC & Central Monitoring Station Integrations
The disposition attribute is optional and will not always have data. Disposition can only be set for alerts in the ACCEPTED status.
A sample request looks as follows:
GET /v1/alerts?limit=10&start=0&end=1671736239735 HTTP/1.1
Host: edx-sandbox.rapidsos.com
Authorization: Bearer YOUR-ACCESS-TOKENA sample response looks as follows:
{
"alerts_until": 1581110270622,
"alerts": [
{
"source_id": "abc123",
"incident_time": 1581110270622,
"location": {
"geodetic": {
"latitude": 45.123,
"longitude": -71.321,
"uncertainty_radius": 7.5
},
"civic": {
"name": "RapidSOS HQ",
"street_1": "123 Main Street",
"street_2": "Apt. 626",
"city": "Los Angeles",
"state": "California",
"country": "USA",
"zip_code": 11375
}
},
"status": {
"name": "RECEIVED",
"display_name": "Received"
},
"disposition": {
"name": "DISPATCHED",
"display_name": "Dispatched"
},
"disposition_message": "Declined due to insufficient details",
"last_updated_time": 1581110270622,
"id": "6e58d630-d28f-4623-ba01-3207b497a9ba",
"emergency_type": {
"name": "BURGLARY",
"display_name": "Burglary"
},
"site_type": {
"name": "RESIDENTIAL",
"display_name": "Residential"
},
"covering_psap": {
"id": "NY_123",
"name": "New York Police Department",
"phone": 15555555555
},
"authorized_entity": {
"id": "CS_123",
"name": "Central Station ABC",
"phone": 15555555555
},
"followers": [
"string"
]
}
]
}To view full documentation for this API request, try it out, or obtain code examples, check out our Interactive API Explorer.
2.2 Retrieve Additional Data
When appropriate for your application, you should retrieve the associated additional data from each alert using the RAD-E API. This query will retrieve data fields about an alert that provide additional context to the core alert schema.
Alerts Schema
For more information about the alerts schema, see the API Documentation
Additional Data Schema
For more information about Additional Data Schemas, please visit the article on Additional Data Standard Schemas
RAD-E API
It is strongly recommended that when integrating this API, fields should not be hard-coded. This is because it assumes that information which should be flexible is actually fixed and unchanging. It is best practice to develop a UI renderer based on our auto-rendering schema language to allow for generating UI components native to your software for any data fields that might be added, updated, etc. for any source.
A sample request looks as follows:
POST /v2/emergency-data/session HTTP/1.1
Host: edx-sandbox.rapidsos.com
Content-Type: application/json; charset=utf-8
Authorization: Bearer YOUR-ACCESS-TOKEN
{
"query": "alert://alert-6e58d630-d28f-4623-ba01-3207b497a9ba"
}A sample response look as follows:
{
"data-provider-1": {
"data": {
"data-category-1": {
"address_street_1": "1045 Testing Dr",
"address_street_2": "n/a",
"address_city": "Sunnyvale",
"address_state": "CA",
"address_zip_code": "94086",
"address_country": "US",
"company": "Cove Home Security",
"account_number": "132966",
"alarm_description": "n/a",
"zone_id": "12212",
"zone_name": "Living Room",
"partition_id": "n/a",
"alarm_state": "n/a",
"panel_ip": "n/a",
"caller_id": "+15555555558",
"address_latitude": 37.369473,
"address_longitude": -122.006768,
"alarm_age": "1",
"contact_id_2": "n/a",
"contact_id": "101",
"contacts": [
{
"name": "John Doeseph",
"phone_number": "+15555555557"
}
],
"account_holder": "John Smith"
}
}
},
"data-provider-2": {
"data": {
"data-category-2": {
"phone_number": "+442025556565",
"first_name": "Pamela",
"last_name": "Jackson",
"provider_name": "Brian Brown",
"gender": "Female",
"date_of_birth": -1000,
"age": 42,
"home_address": {
"street1": "4565 Mitchell Turnpike",
"street2": "42155 Rivas Ford",
"city": "Janeville",
"zip_code": "54126",
"state": "Arizona"
},
"medical_fields": [
{
"description": "nothing",
"timestamp": 1600792965152,
"timestamp_info": "first test"
},
{
"description": "important",
"timestamp": 1600792965152,
"timestamp_info": "second test"
}
],
"preexisting_conditions": "",
"allergies": "dust , peanuts",
"medical_other": "n/a",
"emergency_contacts": [
{
"name": "john",
"relation": "father",
"email": "[email protected]",
"phone_number": "+12035516724"
}
],
"request_id": "1234",
"last_updated": 1600792965152
}
}
}
}To view full documentation for this API request, try it out, or obtain code examples, check out our Interactive API Explorer.
2.3 Retrieve Alert Log Messages
All messages sent or received regarding a given alert are known as alert log messages. This includes messages related to disposition_update, chat, status_update, milestone, and multi_trip_signal. When appropriate for your application, you can retrieve the associated log messages for a given alert id using the Alerts Management API. This request returns all log messages that are associated with an alert sorted by created_time.
A sample request looks as follows:
GET /v1/alerts/alert-6e58d630-d28f-4623-ba01-3207b497a9ba/log_messages HTTP/1.1
Host: edx-sandbox.rapidsos.com
Content-Type: application/json; charset=utf-8
Authorization: Bearer YOUR-ACCESS-TOKENA sample response looks as follows:
{
"total_records": 1,
"log_messages": [
{
"alert_id": "alert-6e58d630-d28f-4623-ba01-3207b497a9ba",
"message": "Hello world!",
"message_type": "CHAT_MESSAGE",
"sender": "John Doe",
"sender_id": "RapidSOS-41",
"entity_display_name": "Acme Alerts Inc.",
"created_at": 1608745599391
}
]
}To view full documentation for this API request, try it out, or obtain code examples, check out our Interactive API Explorer.