National Weather Service API Demo

by Fran T

Version 3 (October 17, 2018)

Download (8 downloads)

Demonstrates the use of the United States National Weather Service Forecast and Alerts services. Several unconnected blocks are also provided which demonstrate parsing dates from the APIs.

The flows are written as subroutines to be easier to copy and incorporate into your own flows.

Also included is a simple-minded flow for determining whether the current location is within the United States. -Although the NWS API services return a 404 status if the given location is not within the United States, it's usually quicker to check via reverse geocoding. If you elect not to use it, the weather flows will show the same message if a 404 status is received.

The main 'Forecast with Alerts' flow displays the upcoming 24-hour forecast (from the returned week's worth) and any weather alerts which are active. It does this by issuing the two HTTP requests in parallel and coalescing the results when they complete. The "For each in serviceEndpoints" loop can be used as a general-purpose flow to do this in your own flows.

Be aware that the service is sometimes slow and the requests may time out. The flow will retry each up to three times. Detailed information about each failure is logged if logging for the flow is enabled.

Also see:

o Improved error reporting and handling
o Simplified use of inUsa subroutine