What this is
This endpoint exists so a Dartastic demo can show a real, cross-language distributed trace on its very first run. A Dart or Flutter app calls this API; this API is a Firebase TypeScript function that calls Open-Meteo. Every hop is instrumented with OpenTelemetry, so the whole path (your app, this TypeScript function, and the upstream call) shows up as one trace in your Dartastic Observability backend. Trace context propagates across languages the whole way.
weather_api
service from the reference repo.
Get a token
- Sign in at dartastic.io. A free account is enough; no subscription required.
- Open Tokens in your dashboard.
- Click Generate Weather API Token and copy the token (it is shown once).
Send the token as a bearer credential on every request:
Authorization: Bearer <your-weather-token>
An anonymous request is rejected with 401 before it
touches anything downstream.
Endpoints
| Method & path | Purpose |
|---|---|
GET /weather/<city>?days=N |
Geocode the city name, then return its forecast. days
is 1 to 16 (default 3). |
GET /v1/geocode?q=<query>&limit=<n> |
Resolve a place name to candidate cities (coordinates, country, timezone). |
POST /v1/forecast |
Body {"city": City, "forecastDays": n}; returns the
forecast for an already-resolved city. |
GET /health |
Uptime probe (no token required). |
Example
curl -H "Authorization: Bearer $WEATHER_TOKEN" \
"https://weather.dartastic.io/weather/Boston?days=3"
Response shape
The wire format matches the reference demo's weather_api
service field for field, so a demo client can point at either one:
{
"city": {
"id": 4930956,
"name": "Boston",
"latitude": 42.35843,
"longitude": -71.05977,
"country": "United States",
"countryCode": "US",
"admin1": "Massachusetts",
"timezone": "America/New_York"
},
"current": {
"observedAt": "2026-07-08T14:30:00.000",
"temperatureCelsius": 21.5,
"apparentTemperatureCelsius": 20.1,
"relativeHumidityPercent": 55,
"windSpeedKmh": 12.3,
"precipitationMm": 0,
"weatherCode": 3,
"isDay": true
},
"daily": [
{
"date": "2026-07-08T00:00:00.000",
"weatherCode": 3,
"temperatureMinCelsius": 12.0,
"temperatureMaxCelsius": 24.0,
"precipitationSumMm": 0,
"sunrise": "2026-07-08T05:12:00.000",
"sunset": "2026-07-08T20:45:00.000"
}
],
"fetchedAt": "2026-07-08T14:30:05.000Z"
}
Errors
Errors return a small JSON body. Validation problems use
{"error": "invalid_request", "message": ...}; upstream
problems use {"error": <kind>, "message": ..., "provider":
"open-meteo"}. Over-budget requests return 429; the
daily counter resets at 00:00 UTC.
Attribution
Weather data comes from Open-Meteo, licensed under CC BY 4.0.