Home » Php » api.weather.gov start and end times

api.weather.gov start and end times

Posted by: admin October 29, 2018 Leave a comment

Questions:

I’ve been using the alerts feature from the relatively new V3 API from weather.gov. I have been successfully using the API to view current alerts at https://api.weather.gov/alerts/active using PHP with the appropriate accept, version and user-agent headers being sent in the HTTP request.

I’m now looking to expand this to allow querying for inactive alerts for a specific date. The documentation spells out start and end parameters in ISO8601DateTime format. Thus the following example URL should produce a list of all alerts on May 15, 2018 in Illinois:

https://api.weather.gov/alerts?start=2018-05-14T00:00:00-05:00&end=2018-05-15T00:00:00-05:00&state=IL

However this produces the response:

{
   "type": "FeatureCollection",
   "features": [],
   "title": "Watches, warnings, and advisories issued between Mon, May 14, 2018 12:00:00 AM -0500 and Tue, May 14, 2018 12:00:00 AM -0500 for Illinois"
}

The response makes it clear that the parameters are being parsed correctly. And I know there were plenty of alerts issued this day throughout Illinois. I have also tried plenty of variations of shorter and longer duration, different time zones (including none), different dates and different states, including no state provided. All of them provide similar results describing the list, but no actual data.

Has anyone found better documentation on the API or otherwise had success with the alert start and end times?

You can find the (in)complete documentation of the API here.

Answers: