Implemented weather stories support
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
All checks were successful
ci/woodpecker/push/build-image Pipeline was successful
This commit is contained in:
87
docs/api.md
87
docs/api.md
@@ -63,6 +63,7 @@ Supported where documented:
|
||||
- if both are provided, they must match exactly or the request fails
|
||||
|
||||
Timezone affects datetime rendering and day-slice filtering for `/today` and `/tomorrow` forecast routes.
|
||||
It also affects weather story and discussion datetime rendering.
|
||||
|
||||
### Query validation
|
||||
|
||||
@@ -223,6 +224,42 @@ Discussion section object fields:
|
||||
- `narrative` (string, optional)
|
||||
- `issuedAt` (RFC3339 datetime, optional)
|
||||
|
||||
## Weather Stories endpoints
|
||||
|
||||
- `GET /weatherstories`
|
||||
- `GET /weatherstories/latest`
|
||||
|
||||
Query parameters:
|
||||
|
||||
- `units`: `metric` | `us` (accepted; does not materially alter weather story payloads)
|
||||
- `format`: `json` | `xml` | `text`
|
||||
- `tz` or `TZ`: timezone selector
|
||||
|
||||
Response behavior:
|
||||
|
||||
- `/weatherstories` returns the latest stored weather story run and its ordered stories.
|
||||
- `/weatherstories/latest` returns the single story with the greatest `updatedAt`.
|
||||
- When no weather story data exists, `data` is `null`.
|
||||
|
||||
`/weatherstories` response `data` fields:
|
||||
|
||||
- `officeId` (string, optional)
|
||||
- `asOf` (RFC3339 datetime, required)
|
||||
- `stories` (array, required)
|
||||
|
||||
Weather story fields:
|
||||
|
||||
- `officeId` (string, optional)
|
||||
- `startTime` (RFC3339 datetime, required)
|
||||
- `endTime` (RFC3339 datetime, required)
|
||||
- `updatedAt` (RFC3339 datetime, required)
|
||||
- `title` (string, optional)
|
||||
- `description` (string, optional)
|
||||
- `altText` (string, optional)
|
||||
- `priority` (boolean, required)
|
||||
- `order` (integer, required)
|
||||
- `downloadUrl` (string, optional)
|
||||
|
||||
## Examples
|
||||
|
||||
### Observation (JSON, metric)
|
||||
@@ -338,6 +375,56 @@ GET /discussion/key-messages?format=json&tz=Chicago
|
||||
}
|
||||
```
|
||||
|
||||
### Weather stories (JSON)
|
||||
|
||||
```http
|
||||
GET /weatherstories?format=json&tz=America/Chicago
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"officeId": "LSX",
|
||||
"asOf": "2026-05-30T04:00:34-05:00",
|
||||
"stories": [
|
||||
{
|
||||
"officeId": "LSX",
|
||||
"startTime": "2026-05-30T03:46:00-05:00",
|
||||
"endTime": "2026-05-31T06:00:00-05:00",
|
||||
"updatedAt": "2026-05-30T04:00:34-05:00",
|
||||
"title": "Several Chances for Rain Through Monday",
|
||||
"description": "Scattered showers and thunderstorms remain possible.",
|
||||
"altText": "This slide shows the forecast for today through Tuesday.",
|
||||
"priority": false,
|
||||
"order": 1,
|
||||
"downloadUrl": "https://api.weather.gov/offices/LSX/weatherstories/download/3228e499-2aae-45a8-9ff9-1c060311026f"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Latest weather story (JSON)
|
||||
|
||||
```http
|
||||
GET /weatherstories/latest?format=json&tz=CDT
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"data": {
|
||||
"officeId": "LSX",
|
||||
"startTime": "2026-05-30T03:46:00-05:00",
|
||||
"endTime": "2026-05-31T06:00:00-05:00",
|
||||
"updatedAt": "2026-05-30T04:00:34-05:00",
|
||||
"title": "Several Chances for Rain Through Monday",
|
||||
"description": "Scattered showers and thunderstorms remain possible.",
|
||||
"priority": false,
|
||||
"order": 1
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Invalid timezone error example
|
||||
|
||||
```http
|
||||
|
||||
Reference in New Issue
Block a user