Getting Started with AccuWeather APIs
Get familiar with AccuWeather APIs and learn how to set up a developer account and an application to use them.
Overview of AccuWeather APIs
AccuWeather supports a number of weather APIs that provide us with up-to-date and highly accurate weather forecasts around the globe. It provides utility APIs that let users retrieve unique identifiers and geographical coordinates for various locations. This information is useful because most of the APIs we cover in this course require a location's locationKey
, rather than its name as a parameter.
The following illustration explains the flow of the AccuWeather APIs that we'll follow in this course.
Types of APIs
AccuWeather offers two types of APIs: Core weather API and MinuteCast API. The Core weather API provides endpoints to get daily and hourly weather forecasts, current conditions, and daily index data, among others. Moreover, it provides endpoints to search for locations all around the world, including cities and countries. The MinuteCast API allows us to get a 120-minute precipitation forecast for a specific location.
Both APIs provide a range of subscription packages to meet the exact needs of customers. In this course, we'll use the free subscription package for the Core weather API.
Now, let’s look at the steps we need to take to call the AccuWeather APIs.
Set up a developer account
To call the AccuWeather APIs, we first need to register and create a developer account. Follow the steps below to create a developer account.
Step 1: Go to the AccuWeather Developer Portal and click the "REGISTER" button at the top.
Step 2: This opens a new user registration form in a modal window. Fill out the form and click the "CREATE NEW ACCOUNT" button.
Step 3: An automatic confirmation email is sent to your registered email address. Click the confirmation link given in the email.
Step 4: You are redirected to the password reset page. Click the "LOG IN" button.
Step 5: You are redirected to the "Edit Profile" page. Fill out the form to change the account's password and click the "SAVE" button.
Create an application
After setting up our developer account and logging in, we need to create an application. This allows us to get our API key that enables us to call the AccuWeather APIs. Follow the steps below to create an application and get the API key.
Step 1: Click the user email from the top menu bar. From the dropdown menu, select "My Apps." You may click "MY APPS" from the menu bar just below the AccuWeather APIs logo as well.
Step 2: Click the "Add a new App" button to create a new application.
Step 3: You are redirected to the “Add App” form. Enter the application name. Fill out the rest of the form as follows:
Select "Core Weather Limited Trial" for "Core Weather" under "Products."
Do not select any option for "MinuteCast" under "Products."
Select "Other" from the dropdown list for "Where will the API be used?."
Select "Internal App" for "What will you be creating with this API?."
Select "JavaScript" from the dropdown list for "What programming language is your APP written in?."
Select "Business to Consumer" for "Is this for Business to Business or Business to Consumer use?."
Select "Worldwide" for "Is this Worldwide or Country specific use?."
Step 4: Click the "CREATE APP" button.
You can now see your application on the "My Apps" page.
Get the API key
Now that we’ve created an application, we can get the API key that enables us to make calls to the AccuWeather APIs. Follow the steps below to get the API key.
Step 1: Click the application you just created.
Step 2: Under the "Keys" tab, you can find the "API Key." Copy the API key and paste it somewhere safe.
Click the "Edit" button in the widget below and enter your "API key" in the API_KEY
textbox. Click the "Save" button. This automatically saves your API key throughout the course.
// Validating the API KeyvalidateKey('{{API_KEY}}');
Now that we’ve created our developer account, registered a new application, and generated the API_KEY
, we are ready to go!