Presented by Patrick Labbett for NAEO
Follow the presentation live!
Get real-time weather data directly from the National Weather Service API and integrate temperature checks into Intelligent Series scripting.
We will also showcase using MergeComm to keep weather updated in the background.
Analyze and plan, then implement.
"All of the information presented via the API is intended to be open data, free to use for any purpose."
"As a public service of the United States Government, we do not charge any fees for the usage of this service, although there are reasonable rate limits in place to prevent abuse and help ensure that everyone has access."
"The rate limit is not public information, but allows a generous amount for typical use. If the rate limit is exceed a request will return with an error, and may be retried after the limit clears (typically within 5 seconds). Proxies are more likely to reach the limit, whereas requests directly from clients are not likely."
"A User Agent is required to identify your application. This string can be anything, and the more unique to your application the less likely it will be affected by a security event. If you include contact information (website or email), we can contact you if your string is associated to a security event. This will be replaced with an API key in the future."
More from MDN:
HTTP headers use a key:value format.
The response from
the API will be JSON.
We can use the Intelligent Series ParseJSON scripting element along with JSONPATH syntax to pull information from the API response.
We have a basic understanding of the API usage, but we need to link the pieces together.
If we know the station identifier, we can get the latest data from this endpoint:
If we know the lat/long, we can pull general
details for the location from the API.
We're back where we started: we know the observation station identifier
Observation data can be null
MergeComm can be used as a simple caching method for saving shared data (like weather) without having to make every request on-demand. A busy client could result in API rate limits and other failures.
A well known method of improving user experience on web and software applications is to put potentially long running tasks into a background process (or thread) so a slow email server or API request does not manifest as lag for your agents.
Some of the benefits...
The example script is available on learn.calltheory.com - sign up for a free account for your team.
(Or email email@example.com to request a copy)