Task 1: Obtain an AccuWeather API Key
We will be using AccuWeather developer services to obtain weather forecasts. AccuWeather is an American company that offers international weather forecasting services.
The AccuWeather developer services include an application programming interface (API) that allows us to use their services.
An API generally refers to a software intermediary that enables two applications to communicate with each other.
Step 1: Create an Account
To use the API, you need to create an account first. Go to this link and click on "Create new account," like in the image below.
You will be asked to provide your information to create an account.
After creating your account, a confirmation email will be sent to your email. Once confirmed, you can sign in using your user credentials via the link above.
Step 2: Register an App
After creating an account with AccuWeather, you need to register your application with them to access their API.
To do this, go to the "MY APPS" tab on the landing page, and click on the "+ Add a new App" button, as shown below.
Provide the relevant information about your app (the one you will build), similar to what is shown below. Make sure to select "Core Weather Limited Trial" under the "Products."
After registering your app, it will appear in your list of apps.
Click on the app name to see the information, including the API key (blurred in the image below).
The API Key is a unique string of (apparently) random characters assigned to your registered application, and you must use it when connecting to AccuWeather API. (More on this later!)
Step 3: Review the API Reference
To access the API reference, click on the "API REFERENCE" tab on the landing page.
You will see a reference list of several APIs. Click on "Current Conditions API.”
You will see a list of "methods." Other resources may call these "endpoints."
An API endpoint is the point of entry in a communication channel when two software interacting.
In web applications, API endpoints are web addresses (also called URLs).
Click on the first one, "Current Conditions.”
Detailed documentation on using this endpoint (method) will be presented, as shown below.
Note that to obtain the current weather condition for a given location, you must provide the locationKey
. There is another API you can use to get a location key by searching for its name.
For more information, refer to the "API Flow Diagram" under the "General Information" tab.
The flowchart describes how one can work with the AccuWeather API.