Get a List of Locations

Overview

The Locations API allows us to get detailed information about places around the globe. Among other information, it provides the unique key for each location. This key is important since we'll use it in the coming lessons to invoke other APIs to get various kinds of weather data.

In this lesson, we learn how to get a specified number of top cities around the globe with their detailed information. Moreover, we also learn how to get a list of all countries in a given region along with their basic information.

List the top cities in the world

The Top Cities List endpoint allows us to retrieve a list of the top cities in the world. The ranking of the cities is based on a number of factors including, but not limited to, the population of the city, its political importance, and its geographic size. This endpoint provides detailed information for each city, including its geographical position, timezone, and population. We can retrieve information for the top 50, 100, or 150 cities worldwide using this endpoint.

Let's make a GET request to the following URL to get a list of a certain number of top cities around the world:

http://dataservice.accuweather.com/locations/v1/topcities/{group}

Input parameters

Get hands-on with 1200+ tech skills courses.