How to send a weather observation request
This section provides an example of a weather observation request.
Note
This example uses a HERE token to authenticate your request. For the available authentication options, see the Identity and Access Management Developer Guide.
User story
The user wants to obtain the current weather conditions for Berlin, Germany.
Request summary
| Resource | report: Note that resource representation is specified via extensions .xml or .json. |
| Parameters | product: Indicates what kind of report the query requests; in this example, the query uses the parameter value observation to request a report on the current weather conditions at the eight closest reporting points to the specified location.name: Indicates the name of the city for which the query requests a weather report. |
Request
The following code block demonstrates the complete request, specifying that the response data is to be delivered in JSON.
curl https://weather.cc.api.here.com/weather/1.0/report.json
?product=observation
&name=Berlin-Tegel
-H "Authorization: Bearer {YOUR_TOKEN}"Here is the same request indicating that the response data is to be delivered in XML.
curl https://weather.cc.api.here.com/weather/1.0/report.xml
?product=observation
&name=Berlin-Tegel
-H "Authorization: Bearer {YOUR_TOKEN}"Response
The response to the request contains:
- A series of locations with observation information.
- Weather report information for each location.
The example response in JSON format is as follows:
{
"observations":{
"location":[
{
"observation":[
{
"daylight":"D",
"description":"Partly sunny. Chilly.",
"skyInfo":"14",
"skyDescription":"Partly sunny",
"temperature":"1.00",
"temperatureDesc":"Chilly",
"comfort":"-0.70",
"highTemperature":"*",
"lowTemperature":"*",
"humidity":"87",
"dewPoint":"-1.00",
"precipitation1H":"*",
"precipitation3H":"*",
"precipitation6H":"*",
"precipitation12H":"*",
"precipitation24H":"*",
"precipitationDesc":"*",
"airInfo":"*",
"airDescription":"",
"windSpeed":"5.56",
"windDirection":"30",
"windDesc":"Northeast",
"windDescShort":"NE",
"barometerPressure":"1016.26",
"barometerTrend":"",
"visibility":"7.00",
"snowCover":"*",
"icon":"6",
"iconName":"mostly_cloudy",
"iconLink":"https://weather.api.here.com/static/weather/icon/17.png",
"ageMinutes":"39",
"activeAlerts":"0",
"country":"Germany",
"state":"Berlin",
"city":"Berlin-Tegel",
"latitude":52.56,
"longitude":13.31,
"distance":0,
"elevation":31,
"utcTime":"2015-01-21T13:20:00.00+01:00"
}
],
"country":"Germany",
"state":"Berlin",
"city":"Berlin-Tegel",
"latitude":52.56,
"longitude":13.31,
"distance":0,
"timezone":1
}
]
},
"feedCreation":"2015-01-21T12:59:49.582Z",
"metric":true
}The example response in XML format is as follows:
<WeatherReport>
<observations>
<location timezone="1" distance="0.00" longitude="13.31" latitude="52.56" city="Berlin-Tegel" state="Berlin" country="Germany">
<observation utcTime="2015-01-21T13:20:00.00+01:00" elevation="31.00" distance="0.00" longitude="13.3100" latitude="52.5600" city="Berlin-Tegel" state="Berlin"
country="Germany">
<daylight>D</daylight>
<description>Partly sunny. Chilly.</description>
<skyInfo>14</skyInfo>
<skyDescription>Partly sunny</skyDescription>
<temperature>1.00</temperature>
<temperatureDesc>Chilly</temperatureDesc>
<comfort>-0.70</comfort>
<highTemperature>*</highTemperature>
<lowTemperature>*</lowTemperature>
<humidity>87</humidity>
<dewPoint>-1.00</dewPoint>
<precipitation1H>*</precipitation1H>
<precipitation3H>*</precipitation3H>
<precipitation6H>*</precipitation6H>
<precipitation12H>*</precipitation12H>
<precipitation24H>*</precipitation24H>
<precipitationDesc>*</precipitationDesc>
<airInfo>*</airInfo>
<airDescription />
<windSpeed>5.56</windSpeed>
<windDirection>30</windDirection>
<windDesc>Northeast</windDesc>
<windDescShort>NE</windDescShort>
<barometerPressure>1016.26</barometerPressure>
<barometerTrend />
<visibility>7.00</visibility>
<snowCover>*</snowCover>
<icon>6</icon>
<iconName>mostly_cloudy</iconName>
<iconLink>https://weather.api.here.com/static/weather/icon/17.png</iconLink>
<ageMinutes>36</ageMinutes>
<activeAlerts>0</activeAlerts>
</observation>
</location>
</observations>
<feedCreation>2015-01-21T12:56:09.739Z</feedCreation>
<metric>true</metric>
</WeatherReport>
For more details about responses to this type of request, see Report response For more information, see Weather report.
Updated 4 days ago