Step 4
We will use an application called Postman to explore the AccuWeather API. Please refer to the Logistics document for instructions to download and install Postman on your computer.
Postman is an API Development Environment (ADE).
Postman was initially a Chrome extension designed to help developers explore APIs. Since then, it has matured into a stand-alone application, an industry standard for designing, documenting, testing, and interacting with APIs.
Open Postman and click on the +
button to create a new API request.
We must enter the request URL (i.e., an API endpoint) in the designated area.
Suppose we want to get the "location key" given a city name using the AccuWeather API. First, we must refer to the API reference to learn how to do this.
From the reference, the request URL is http://dataservice.accuweather.com/locations/v1/cities/search
. Moreover, we must provide the apikey
and the q
(short for "query") parameters.
Please provide the required information, as shown in the image below.
Click on the "Send" button to send the "request." It will take a moment, and then you will see the "response."
Notice the response is in JSON format. It is an array of objects. Each object corresponds to a city or location that matched the name "baltimore." There is much information about each location, including a "key" attribute. We need the "key" to get weather forecast data related to a location.