以编程方式访问避难所数据
Schutzraum API提供对所有避难所数据的只读访问。需要API密钥,您可以在账户中申请。
https://schutzraum.app请合理使用API。过多的请求可能会被限流。
所有API请求都需要有效的API密钥。作为请求头或查询参数发送:
作为请求头(推荐):
X-API-Key: dein_api_key作为查询参数:
/api/shelters?api_key=dein_api_key可以在账户的「API密钥」下申请API密钥。人工审核后密钥将被激活(通常在48小时内)。
返回分页的避难所列表,支持可选筛选。还支持使用lat、lng和radius参数进行地理筛选——地理请求自动按距离排序并包含距离字段。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
page | number | 否 | 1 | Page number |
limit | number | 否 | 20 | Items per page (1–10000) |
type | string | 否 | – | Shelter type filter |
city | string | 否 | – | City name (partial match) |
search | string | 否 | – | Search name, city, address |
condition | string | 否 | – | gut, mittel, schlecht, unbekannt |
protection | string | 否 | – | hoch, mittel, niedrig, unbekannt |
wheelchair | boolean | 否 | – | Filter wheelchair accessible |
verified | boolean | 否 | – | Filter verified shelters |
minCapacity | number | 否 | – | Minimum capacity |
sort | string | 否 | name | name, city, capacity, type |
order | string | 否 | asc | asc or desc |
GET /api/shelters?type=bunker&city=Berlin&limit=10
{
"data": [{ "id": "...", "name": "...", "type": "bunker", ... }],
"total": 42,
"page": 1,
"limit": 10,
"totalPages": 5
}按ID返回单个避难所。
GET /api/shelters/24b4e1f0-7723-45a7-bd1c-537a2ff02174
返回地理点给定半径内的避难所,按距离排序。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
lat | number | 是 | – | Latitude (–90 to 90) |
lng | number | 是 | – | Longitude (–180 to 180) |
radius | number | 否 | 5000 | Radius in meters (100–50000) |
limit | number | 否 | 20 | Max results (1–100) |
type | string | 否 | – | Shelter type filter |
GET /api/shelters/nearby?lat=48.137&lng=11.576&radius=3000
返回地理边界框内的所有避难所。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
west | number | 是 | – | West longitude |
south | number | 是 | – | South latitude |
east | number | 是 | – | East longitude |
north | number | 是 | – | North latitude |
type | string | 否 | – | Shelter type filter |
GET /api/shelters/bbox?west=11.4&south=48.0&east=11.7&north=48.2
以GeoJSON FeatureCollection格式返回所有避难所,用于地图渲染。
| 参数 | 类型 | 必填 | 默认值 | 描述 |
|---|---|---|---|---|
type | string | 否 | – | Shelter type filter |
wheelchair | boolean | 否 | – | Filter accessible |
verified | boolean | 否 | – | Filter verified |
minCapacity | number | 否 | – | Minimum capacity |
GET /api/shelters/geojson?type=u_bahn_station&wheelchair=true
{
"type": "FeatureCollection",
"features": [{
"type": "Feature",
"geometry": { "type": "Point", "coordinates": [11.576, 48.137] },
"properties": { "id": "...", "name": "...", "type": "u_bahn_station", ... }
}]
}type参数接受以下值:
| Value | Label |
|---|---|
bunker | 地堡 |
tiefgarage | 地下车库 |
u_bahn_station | 地铁站 |
tunnel | 隧道 |
keller | 地下室 |
hochbunker | 地上碉堡 |
tiefbunker | 地下碉堡 |
sonstige | 其他 |