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: 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 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 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=alerts
&name=Duluth

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=alerts
&name=Duluth

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.

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.