Cities Cost of Living

FREEMIUM
(Ким) Ditno | Оновлено 25 дней назад | Travel
Популярність

8.3 / 10

Затримки

1,676ms

Рівень обслуговування

100%

Health Check

N/A

Назад до всіх навчальних посібників (2)

How To Get the Details for Multiple Cities & Currencies (Coordinates)

Goal

To use coordinates and a radius to get the details for 1 (or more) cities and in 1 (or more) currencies. The endpoint is get_cities_details_by_coordinates POST.

About Form Data (required and optional parameters)

In the Request Body send Form Data with the parameters latitude, longitude, currencies, radius and distance_unit.

  • latitude, longitude and currencies are required and they represent the coordinates you want to get the information for and the currencies that you want the prices/values in.
  • radius (default 100) and distance_unit (default kilometers) are optional. They represent the distance that you want to include in the results, starting from the coordinates sent in latitude and longitude.

Take a look at the Example section of this tutorial for an example or, alternatively, check the Example in the Endpoints tab.

Example

Let’s imagine you want to get information about all the cities that are 150 miles around Paris, France. Adding to that, you want to get all the prices/values for those cities in 3 different currencies: Euro, US Dollar and Suisse Franc.

Request Body / Form Data

Parameter latitude:

48.864716

Parameter longitude:

2.349014

Parameter currencies:

[
   "Euro *(example of a wrong currency code)*",
   "USD",
   "CHF"
]

Parameter radius:

150

Parameter distance_unit:

miles

Notes about the Parameters

  • The Parameter currencies is a JSON object. Be aware of single quotes vs double quotes, or escaping/not-escaping special characters, for example.
  • The code for the Euro is EUR, which means the results would not contain any data in the Euro. Please use the endpoint get_currencies_list to get all the available currencies and the code to use. Accepting multiple codes for the same currency (in this case, accepting either Euro or EUR) could be introduced in the future if needed.
  • The parameter radius is a float.
  • The parameter distance_unit is a string, and it can be any of km | mi | kilometers | miles | m | meters | feet | ft | nautical | nm

Results

{
   "data": [
      {
         "cost_of_living_details": [
            {
               "currency": "USD",
               "details": [
                  {
                     "Item": "1 Pair of Nike Running Shoes (Mid-Range)",
                     "Range": "54.49-108.97",
                     "Value": "82.96"
                  },
                  {
                     "Item": "1 Pair of Men Leather Business Shoes",
                     "Range": "54.49-145.3",
                     "Value": "93.16"
                  },
                  {
                     "Item": "Apartment (1 bedroom) in City Centre",
                     "Range": "847.56-1331.88",
                     "Value": "998.29"
                  },
                  {
                     "Item": "Apartment (1 bedroom) Outside of Centre",
                     "Range": "605.4-968.64",
                     "Value": "769.84"
                  },
                  {
                     "Item": "Average Monthly Net Salary (After Tax)",
                     "Range": "N/A",
                     "Value": "1270.18"
                  },
                  {
                     "Item": "Mortgage Interest Rate in Percentages (%), Yearly, for 20 Years Fixed-Rate",
                     "Range": "1.45-3.63",
                     "Value": "2.57"
                  }
               ]
            },
            {
               "currency": "CHF",
               "details": [
                  {
                     "Item": "Estimated Monthly Costs Without Rent",
                     "Range": "N/A",
                     "Value": "601.38"
                  },
                  {
                     "Item": "Meal, Inexpensive Restaurant",
                     "Range": "6.48-12.96",
                     "Value": "8.64"
                  },
                  {
                     "Item": "Meal for 2 People, Mid-range Restaurant, Three-course",
                     "Range": "27.01-59.42",
                     "Value": "37.81"
                  },
                  {
                     "Item": "McMeal at McDonalds (or Equivalent Combo Meal)",
                     "Range": "6.48-7.56",
                     "Value": "7.02"
                  },
                  {
                     "Item": "Domestic Beer (0.5 liter draught)",
                     "Range": "1.08-3.65",
                     "Value": "2.16"
                  },
                  {
                     "Item": "Imported Beer (0.33 liter bottle)",
                     "Range": "2.16-5.4",
                     "Value": "3.24"
                  },
                  {
                     "Item": "Cappuccino (regular)",
                     "Range": "0.76-3.24",
                     "Value": "1.81"
                  },
                  {
                     "Item": "Coke/Pepsi (0.33 liter bottle)",
                     "Range": "1.08-2.16",
                     "Value": "1.5"
                  }
               ]
            }
         ],
         "cost_of_living_index": "54.66",
         "cost_of_living_plus_rent_index": "44.23",
         "country": "France",
         "groceries_index": "42.14",
         "last_updated_timestamp": "2021-02-13 19:35:20.566810+00:00",
         "local_purchasing_power_index": "47.87",
         "name": "Paris",
         "rent_index": "32.38",
         "restaurant_price_index": "47.61",
         "us_state": "N/A"
      },
      {
         "cost_of_living_details": [
            {
               "currency": "USD",
               "details": [
                  {
                     "Item": "Meal for 2 People, Mid-range Restaurant, Three-course",
                     "Range": "119.88-199.79",
                     "Value": "139.86"
                  },
                  {
                     "Item": "McMeal at McDonalds (or Equivalent Combo Meal)",
                     "Range": "11.99-16.99",
                     "Value": "14.99"
                  }
                  {
                     "Item": "Imported Beer (0.33 liter bottle)",
                     "Range": "9.0-13.98",
                     "Value": "9.99"
                  },
                  {
                     "Item": "Cappuccino (regular)",
                     "Range": "3.0-5.99",
                     "Value": "5.27"
                  },
                  {
                     "Item": "Coke/Pepsi (0.33 liter bottle)",
                     "Range": "2.0-3.5",
                     "Value": "2.82"
                  }
               ]
            },
            {
               "currency": "CHF",
               "details": [
                  {
                     "Item": "Mortgage Interest Rate in Percentages (%), Yearly, for 20 Years Fixed-Rate",
                     "Range": "5.94-8.1",
                     "Value": "7.27"
                  }
               ]
            }
         ],
         "cost_of_living_index": "146.91",
         "cost_of_living_plus_rent_index": "122.91",
         "country": "France",
         "groceries_index": "144.42",
         "last_updated_timestamp": "2021-02-13 19:31:32.033652+00:00",
         "local_purchasing_power_index": "93.49",
         "name": "Lille",
         "rent_index": "95.61",
         "restaurant_price_index": "157.89",
         "us_state": "N/A"
      }
   ]
}

Notes about the Results

  • The results only include the cities that are in those 150 miles radius of Paris’ coordinates.
  • The results only include the valid currencies in the request body. In this example, only the prices/values in USD and CHF were valid arguments to the endpoint.
  • The results shown here as an example do not include all the possible items that the data contains. Please take a look at the example Response in the Endpoints section, for the endpoint get_cities_details_by_coordinates.