Location Alerts
Endpoint
POST https://api.i3.safeandthecity.com/api/v1/alert/location
i3 Location Alerts allows us to get identify i3 Alerts that may affect a specific point of interest. This endpoint allows us to provide contextual location risk information to end users. By using the optional start_date
querystring parameter, we can plan journeys in to the future with the current available information.
Request
- Python
- Javascript
import requests
from geojson import Feature, Point, FeatureCollection
# Send a FeatureCollection with a Point to identify alerts relating to this location
location = Point((-0.127642, 51.530194))
feature = Feature(geometry=location)
data = FeatureCollection([feature])
r = requests.post('https://api.i3.safeandthecity.com/api/v1/alert/location', headers={'Content-Type': 'application/json', 'x-api-key': '{YOUR_API_KEY}'}, json=data)
import axios from 'axios';
const data = { // Send a FeatureCollection with a Point to identify alerts relating to this location
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-0.127642, 51.530194
]
}
]
}
}
const instance = axios.create({
baseURL: 'https://api.i3.safeandthecity.com/api',
timeout: 1000,
headers: {
'Content-Type': 'application/json'
'x-api-key': '{YOUR_API_KEY}'
}
});
let response = instance.post('/v1/alert/location', data);
Accepted Parameters
Parameters | Type | Description | Required |
---|---|---|---|
Authorization | header | The Bearer token to authenticate with the server | Yes |
data | body | The body parameter expects a valid geojson FeatureCollection with a Point (See GeoJSON standard). This Point should represent a location of interest for which you wish to retrieve alerts | Yes |
start_date | querystring | The start_date querystring allows us to define a data and time in the future to facilitate journey planning. If left empty this will default to the current data and time | No |
Response
Location Alerts Response
{
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-0.127642, 51.530194
]
},
},
{
"id": "d140f8f3-7818-4f9a-bd42-d23c084dc677",
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
-0.127557,
51.503339
]
},
"properties": {
"description": "London Euromaidan have organised a protest outside 10 Downing Street to demand the UK government to do more to stop the Ukraine war.",
"location": "10 Downing Street, 10 Downing St, London, England SW1A 2AB, United Kingdom",
"start_date": "2022-08-17T17:00:00Z",
"title": "Ukraine War",
"type": "PROTEST"
}
}
]
}
info
Should no alerts affect the requested location, the same FeatureCollection
you requested will be returned with no properties.