List Cities
This guide explains how to retrieve a list of all cities using the Aara API. We'll start with an example using curl and follow it up with JavaScript examples utilizing the native fetch API.
Curl example
curl -X GET "https://api.aara.app/v1/cities" \ -H "AARA_API_KEY: YOUR_API_KEY" \ -H "UNIQUE_USER_ID: UNIQUE_USER_ID"
JavaScript example
const listCities = async () => {
const response = await fetch("https://api.aara.app/v1/cities", {
method: "GET",
headers: {
AARA_API_KEY: "YOUR_API_KEY",
UNIQUE_USER_ID: "UNIQUE_USER_ID",
},
});
const data = await response.json();
console.log(data);
};
listCities();
Instructions:
- Replace
YOUR_API_KEYandUNIQUE_USER_IDwith your actual credentials. - This API call will return a list of all available cities on the Aara platform.
Response
The response from the API will be a JSON object containing an array of cities, with each city including details like the city name, ID, full address, latitude, longitude, weather, and more.
Example Response
[
{
id: "abcdefghijklmn1234567890",
name: "Paris",
fullAddress: "Paris, France",
lat: 48.856614,
lng: 2.3522219,
weather: "Sunny",
smallIconUrl: "https://example.com/weather-icon.png",
currencySymbol: "€",
videoUrl: "https://example.com/paris-video.mp4",
},
{
id: "abcdefghijklmn1234567890",
name: "London",
fullAddress: "London, UK",
lat: 51.507351,
lng: -0.127758,
weather: "Cloudy",
smallIconUrl: "https://example.com/weather-icon.png",
currencySymbol: "£",
videoUrl: "https://example.com/london-video.mp4",
},
];
This response shows a list of cities with details like the city ID, name, full address, latitude, longitude, weather, and other relevant information.