Weather API Developer's Guide

Weather Observation Example

This section provides an example of a weather observation request.

Note: The code examples use the placeholder text {YOUR_APP_CODE} and {YOUR_APP_ID} to indicate places where you should substitute your own unique app_id and app_code values. For more information about these authentication credentials, see Acquiring Credentials.

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 code block below demonstrates the complete request, specifying that the response data are to be delivered in JSON.


https://weather.cit.api.here.com/weather/1.0/report.json
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&product=observation
&name=Berlin-Tegel

Here is the same request indicating that the response data are to be delivered in XML.


https://weather.cit.api.here.com/weather/1.0/report.xml
?app_id={YOUR_APP_ID}
&app_code={YOUR_APP_CODE}
&product=observation
&name=Berlin-Tegel

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.cit.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.cit.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.