V2 API

From floodzilla-wiki
Revision as of 18:54, 20 March 2023 by DaveSanderman (talk | contribs)
Jump to navigation Jump to search

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",
  "defaultForecastGageList": [
    "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.

GetMetagages

Returns all of the metagages for a region. Currently there is only one metagage 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/GetMetagages?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.