Reference
Sites
The client’s sites and their zones.
The client’s sites
GET/v1/sites
Any valid token.
Responses
- 200
Sites the client can access.
application/json
SiteList - 401
The token is missing, has expired or has been revoked.
application/problem+json
Problem - 403
The token lacks the scope the route requires, or the site doesn’t belong to the client.
application/problem+json
Problem - 429
Too many requests, or too much query time: each client has a number of requests per minute (600 by default) and a query time per minute (30 s by default), and each request spends however long it takes, so a long list counts for more than a single alert.
Retry-Aftersays when to retry.application/problem+json
Problem
Request · sandbox
curl "https://sandbox.api.safeonuba.com/v1/sites" \
-H "Authorization: Bearer $SAFEONUBA_TOKEN"const res = await fetch('https://sandbox.api.safeonuba.com/v1/sites', {
headers: {
Authorization: `Bearer ${process.env.SAFEONUBA_TOKEN}`,
},
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();import os
import requests
res = requests.get(
"https://sandbox.api.safeonuba.com/v1/sites",
headers={"Authorization": f"Bearer {os.environ['SAFEONUBA_TOKEN']}"},
timeout=10,
)
res.raise_for_status()
data = res.json()using System.Net.Http.Headers;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("SAFEONUBA_TOKEN"));
var res = await http.GetAsync("https://sandbox.api.safeonuba.com/v1/sites");
res.EnsureSuccessStatusCode();
var json = await res.Content.ReadAsStringAsync();Response 200
{
"data": [
{
"id": "0f6c2b7e-3a1d-4c55-9b0e-7d2f4a8c1e90",
"name": "Planta Ejemplo — simulación",
"location": "Polígono industrial de ejemplo",
"privacy_mode": "on_demand",
"unveil_min_severity": "low"
}
]
}A site’s zones and muster points
GET/v1/sites/{id}/zones
Scope alerts:read
GeoJSON in WGS84. Privacy zones come with name and type but no geometry.
Path parameters
idstring (uuid)requiredSite id.
Responses
- 200
Zones in force.
application/json
ZoneList - 401
The token is missing, has expired or has been revoked.
application/problem+json
Problem - 403
The token lacks the scope the route requires, or the site doesn’t belong to the client.
application/problem+json
Problem - 404
The site doesn’t exist or doesn’t belong to the client.
application/problem+json
Problem - 429
Too many requests, or too much query time: each client has a number of requests per minute (600 by default) and a query time per minute (30 s by default), and each request spends however long it takes, so a long list counts for more than a single alert.
Retry-Aftersays when to retry.application/problem+json
Problem
Request · sandbox
curl "https://sandbox.api.safeonuba.com/v1/sites/0f6c2b7e-3a1d-4c55-9b0e-7d2f4a8c1e90/zones" \
-H "Authorization: Bearer $SAFEONUBA_TOKEN"const res = await fetch('https://sandbox.api.safeonuba.com/v1/sites/0f6c2b7e-3a1d-4c55-9b0e-7d2f4a8c1e90/zones', {
headers: {
Authorization: `Bearer ${process.env.SAFEONUBA_TOKEN}`,
},
});
if (!res.ok) throw new Error(`${res.status}: ${await res.text()}`);
const data = await res.json();import os
import requests
res = requests.get(
"https://sandbox.api.safeonuba.com/v1/sites/0f6c2b7e-3a1d-4c55-9b0e-7d2f4a8c1e90/zones",
headers={"Authorization": f"Bearer {os.environ['SAFEONUBA_TOKEN']}"},
timeout=10,
)
res.raise_for_status()
data = res.json()using System.Net.Http.Headers;
using var http = new HttpClient();
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(
"Bearer", Environment.GetEnvironmentVariable("SAFEONUBA_TOKEN"));
var res = await http.GetAsync("https://sandbox.api.safeonuba.com/v1/sites/0f6c2b7e-3a1d-4c55-9b0e-7d2f4a8c1e90/zones");
res.EnsureSuccessStatusCode();
var json = await res.Content.ReadAsStringAsync();Response 200
{
"data": [
{
"id": "f6040b41-be81-4bf3-af68-bfaf3e284c54",
"name": "Punto de reunión PR-3 · Zona alta",
"type": "assembly_point",
"geometry": {
"type": "Polygon",
"coordinates": [
[
[
-2.9825,
40.0081
],
[
-2.9818,
40.0081
],
[
-2.9818,
40.0076
],
[
-2.9825,
40.0076
],
[
-2.9825,
40.0081
]
]
]
},
"assembly_point": {
"serves": [
"general",
"tsunami"
],
"elevation_m": 50,
"elevation_source": "verified",
"vertical": false,
"capacity": 200
}
}
]
}