GuidesAPI Reference
Guides

How to request severe weather alerts

This section provides an example of a HERE Destination Weather API request 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 and Access Management Developer Guide.

User story

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

Request summary

Resourcereport
Parameters products: Indicates what kind of report the query requests; in this example, the query uses the parameter value alerts to request any possible weather alerts.


q: Indicates the location name for which the query requests severe weather alerts.

Request

The following code block demonstrates the complete request, specifying that the response data is to be delivered in JSON.

curl https://weather.hereapi.com/v3/report
?producta=alerts
&q=Boston
-H "Authorization: Bearer {YOUR_TOKEN}"

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

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:

{
  "places": [
    {
      "alerts": [
        {
          "place": {
            "address": {
              "countryName": "United States",
              "state": "Massachusetts",
              "city": "Boston"
            },
            "location": {
              "lat": 42.35843,
              "lng": -71.05977
            },
            "distance": 1.4
          },
          "timeSegments": [
            {
              "segment": "morning",
              "weekday": "th"
            }
          ],
          "type": 1,
          "description": "Strong Thunderstorms Anticipated - Strong thunderstorms anticipated during the next 24 hours"
        }
      ]
    }
  ]
}

For more details about responses to this type of request, see Report response For more information, see Weather report.