V2 API
Overview
These notes apply to all Floodzilla services.
All object payloads are in JSON format.
All date/time fields are in UTC.
General Client API
GetRegion
Returns all of the necessary information about a region. The client should hardcode (or, eventually, allow choosing from a list, maybe?) a region id. Currently available region IDs:
| Region 1 | The main SVPA region. Should always be used in production mode. |
| Region 17 | A Testing region. There's nothing there, yet, but hopefully it will have testing data eventually. |
Caching: This is expected to change VERY rarely. Fetch once at app startup and cache forever.
Endpoint: GET /api/v2/GetRegion?regionId=<region>
Example return value:
{
"id": 1,
"name": "Snoqualmie Valley",
"timezone": "America/Los_Angeles",
"baseUrl": "https://floodzilla.com",
"defaultForecastGaugeList": [
"USGS-SF17/USGS-NF10/USGS-MF11",
"USGS-38",
"USGS-22"
]
}
Notes:
- Internally, all times are represented as UTC. Whenever a client displays a time/date, it must be converted to "Region Time" using the region timezone.
GetMetagauges
Returns all of the metagauges for a region. Currently there is only one metagauge in the whole world, and it is in region 1.
Caching: This can change if we change the flood level labels. Fetch once per day.
Endpoint: GET /api/v2/GetMetagauges?regionId=<region>
Example return value:
[
{
"ids": "USGS-SF17/USGS-NF10/USGS-MF11",
"siteIds": "GARW1-SNQW1-TANW1",
"name": "Sum of the 3 forks",
"shortName": "Forks",
"stageOne": 10000,
"stageTwo": 12000
}
]
Notes:
- "Stage One" and "Stage Two" are the flood warning and flooding levels, respectively.
GetForecast
Returns a forecast for the specified set of gauges.
Caching:
New forecasts are published every couple of hours during flood events, and daily? during dry times. The back end checks for new forecasts every 5 minutes.
Endpoint: GET /api/v2/GetForecast?regionId=[region]&gaugeIds=[gageList]&ifNewerThan=[utcTime]
Example Request: GET /api/v2/GetForecast?regionId=1&ifNewerThan=2023-03-27T15:49:00Z&gaugeIds=USGS-SF17/USGS-NF10/USGS-MF11,USGS-38,USGS-22
Example return value:
{
"USGS-SF17/USGS-NF10/USGS-MF11": {
"noaaSiteId": "",
"forecastCreated": "2023-03-27T15:49:00Z",
"forecastId": 0,
"peaks": {
"timestamps": [
"2023-03-28T12:00:00Z",
...],
"waterHeights": [
4.38,
...],
"discharges": [
1345.0,
...]
},
"timestamps": [
"2023-03-27T18:00:00Z",
...],
"waterHeights": [
4.38,
...],
"discharges": [
1349.0,
...]
},
"USGS-38": null,
}
Notes:
Returns 'null' for a gage if the latest forecast is not newer than the specified time.