Chuyển tới nội dung chính

Weather Routes

RESTful API endpoints for querying weather observation entities (WeatherObserved) with temperature, humidity, precipitation, and wind data from Stellio Context Broker.

Base Path

/api/weather

Endpoints Summary

MethodEndpointDescription
GET/List all weather observations
GET/:idGet weather by ID
GET/currentGet current weather for location
GET/forecastGet weather forecast

Endpoints

GET /api/weather

List all weather observations.

Query Parameters:

ParameterTypeDefaultDescription
limitnumber100Maximum results
latnumber-Filter by latitude
lonnumber-Filter by longitude
maxDistancenumber10000Search radius (meters)

Response:

{
"success": true,
"data": [
{
"id": "urn:ngsi-ld:WeatherObserved:001",
"location": {
"latitude": 10.7731,
"longitude": 106.7030
},
"temperature": 32.5,
"humidity": 75,
"precipitation": 0,
"windSpeed": 3.5,
"windDirection": 180,
"weatherType": "partly_cloudy",
"observedAt": "2025-11-29T10:30:00.000Z"
}
]
}

GET /api/weather/current

Get current weather for a specific location.

Query Parameters:

ParameterTypeRequiredDescription
latnumberYesLatitude
lonnumberYesLongitude

Response:

{
"success": true,
"data": {
"temperature": 32.5,
"feelsLike": 36.2,
"humidity": 75,
"precipitation": 0,
"windSpeed": 3.5,
"windDirection": 180,
"weatherType": "partly_cloudy",
"uvIndex": 7,
"visibility": 10000,
"observedAt": "2025-11-29T10:30:00.000Z"
}
}

Weather Types

TypeDescription
clearClear sky
partly_cloudyPartly cloudy
cloudyOvercast
rainLight to moderate rain
heavy_rainHeavy rain
thunderstormThunderstorm
fogFoggy conditions

References