Destination Weather API Developer's Guide

Severe Weather Alerts Example

This section provides an example of a query for severe weather alerts for a specific location.

Note: This example uses a HERE token to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.

User Story

The user wants to obtain possible weather alerts for Duluth, Minnesota.

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 alerts to request any possible weather alerts.
  name – indicates the name of the city for which the query requests severe weather alerts.

Request

The code block below 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=alerts
&name=Duluth
-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=alerts
&name=Duluth
-H "Authorization: Bearer {YOUR_TOKEN}"

Response

The response to the request contains:

  • a severe weather alert for Tuesday night, Wednesday morning

The example response in JSON format is as follows:

{
  "alerts": {
  "alerts": [
    {
    "timeSegment": [
      {
      "value": "",
      "segment": "N",
      "otherAttributes": {},
      "day_of_week": "3"
      },
      {
      "value": "",
      "segment": "M",
      "otherAttributes": {},
      "day_of_week": "4"
      }
    ],
    "type": "17",
    "description": "Wind chill alert"
    }
  ],
  "country": "United States",
  "state": "Minnesota",
  "city": "Duluth",
  "latitude": 46.78327,
  "longitude": -92.10658,
  "timezone": -6
  },
  "feedCreation": "2013-12-10T14:59:31.188",
  "metric": true
}

The example response in XML format is as follows:

<WeatherReport>
  <alerts timezone="-6" longitude="-92.10658" latitude="46.78327" city="Duluth" state="Minnesota" country="United States">
    <alerts>
      <timeSegment day_of_week="3" segment="N"/>
      <timeSegment day_of_week="4" segment="M"/>
      <type>17</type>
      <description>Wind chill alert</description>
    </alerts>
  </alerts>
  <feedCreation>2013-12-10T14:58:43.911Z</feedCreation>
  <metric>true</metric>
</WeatherReport>

For more details about responses to this type of request, see Report Response.