Warnings API

Returns a paginated list of unique warnings, ordered newest first.

GET/api/warningsPublic
Overview

This endpoint reads the warnings table, sorts rows by created_at (descending), deduplicates by id, then returns a page of results. Each item includes a display-ready date and time derived from the warning's onset/effective time, and the area.

Query parameters
NameTypeDefaultDescription
limitinteger50Page size. The server caps it at 100 max. (No minimum clamp is applied.)
offsetinteger0Number of items to skip (pagination). The server clamps this to 0 min.
Response schema
{
  "warnings": [
    {
      "id": "string",
      "date": "DD.MM.YYYY", // derived from onset/effective time
      "time": "HH:mm",      // derived from onset/effective time
      "area": "string"
    }
  ],
  "pagination": {
    "total": number,
    "limit": number,
    "offset": number,
    "hasMore": boolean
  }
}

Note: date and time are human-friendly strings produced on the server. If you need raw timestamps (e.g., ISO 8601 for onsetAt/expiresAt), consider extending the API in a future version.

Examples
curl "https://www.liukasbotti.fi/api/warnings?limit=50&offset=0"
Behavior details
  • Ordering by created_at (newest first), then deduplication by id using a server-side map.
  • date/time come from the warning's onset/effective time.
  • area falls back to an empty string if not present in the row.
Errors
StatusExample bodyWhen
500
{ "error": "Failed to fetch warnings" }
Unexpected server error.