API stands for Application Programming Interface. APIs define how different programs can interact with each other. They provide a set of rules and specifications for how one program can access and use the functionality provided by another program. In addition to documenting how a program or platform works and what it can do, an API typically includes code libraries or other tools that make it easier for developers to use the API in their own programs.
In this lesson, we’ll write a program that utilizes public APIs to access National Weather Service data and print out real-time alerts.
If you are interested in exploring this topic on your own, a Google search for' list of public APIs' will turn up many different results. For now, let’s start with this list.
<https://github.com/public-apis/public-apis>
Search that page for the ‘National Weather Service’ and click the link.

Many of these services require an ‘API Key’, which means you have to sign up. The website will provide you with a secret value (API Key) that you must use each time you make a request to the service. The National Weather Service does not require an API key, making this lesson easier. (Signing up for an API key with any site on this list is usually a simple matter of logging in to the website and saving the unique value they provide. It works like a password. )
One way that APIs are commonly used is through web requests via a script or program running on a user's computer. APIs are commonly accessed over HTTP/https via URL Parameters. The NWS API is simple enough and is a good example of how this API access works.
On the NWS site, let’s go to the ‘Specifications’ tab and see what’s available.

As we can see, they provide an ‘API Endpoint’ of /alerts that will provide us with data. Let’s try the first API endpoint they offer (/alerts). Go to this URL:
<https://api.weather.gov/alerts>

JSON (Key Sec+ Concept) is commonly used to store and retrieve data on the web. We’re looking at a series of key:value pairs. A JSON beautifier will make figuring out how this data is structured easier. Let’s copy and paste all the data from this API endpoint into the website below:
<https://codebeautify.org/jsonviewer>

In the Tree Viewer on the right, click the arrow next to ‘Object’, and all the data will be minimized.

We’ll write a program that prints out all the current NWS Headlines this API endpoint provides. We need to figure out how to access the headline:<somevalue> key/value pair within this data set. Expand Objects and take a look at where the headline key/value is stored within this JSON data.