POST

Geo Location

The geo-details allows you to retrieve precise geographic coordinates, time zone and location details based on the provided place name or phrase. Whether it's a city, landmark, or local address. Please note that the input must be provided in English.

/geo-details
Method
POST
Format
JSON
Auth
API Key
Credits
1

Overview

The geo-details allows you to retrieve precise geographic coordinates, time zone and location details based on the provided place name or phrase. Whether it's a city, landmark, or local address. Please note that the input must be provided in English.

Request Parameters

Parameter Type Required Description Example
location
string Yes Location name Vijaya

Request Example

{
    "location":"vija"
}

Response Examples

Example responses returned by this API.

English
[
    {
        "location_name": "Vijāpur",
        "longitude": 72.74848,
        "latitude": 23.5623,
        "timezone_offset": 5.5,
        "timezone": "Asia/Kolkata",
        "complete_name": "Vijapur, Mahesana, Gujarat, India",
        "country": "India",
        "administrative_zone_1": "Gujarat",
        "administrative_zone_2": "Mahesana"
    },
    {
        "location_name": "Vijayapuri",
        "longitude": 77.50066,
        "latitude": 11.2453,
        "timezone_offset": 5.5,
        "timezone": "Asia/Kolkata",
        "complete_name": "Vijayapuri, Erode, Tamil Nadu, India",
        "country": "India",
        "administrative_zone_1": "Tamil Nadu",
        "administrative_zone_2": "Erode"
    },
    {
        "location_name": "Vijayawada",
        "longitude": 80.6466,
        "latitude": 16.50745,
        "timezone_offset": 5.5,
        "timezone": "Asia/Kolkata",
        "complete_name": "Vijayawada, Krishna, Andhra Pradesh, India",
        "country": "India",
        "administrative_zone_1": "Andhra Pradesh",
        "administrative_zone_2": "Krishna"
    }
]

Code Examples

Use the following examples to integrate this API into your application.

PHP Code
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://json.freeastrologyapi.com/geo-details',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "location":"vijayawa"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'x-api-key: YOUR_API_KEYHERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
Python Code
import requests
import json

url = "https://json.freeastrologyapi.com/geo-details"

payload = json.dumps({
  "location": "vijayawa"
})
headers = {
  'Content-Type': 'application/json',
  'x-api-key': 'YOUR_API_KEYHERE'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)
Node JS Code
var request = require('request');
var options = {
  'method': 'POST',
  'url': 'https://json.freeastrologyapi.com/geo-details',
  'headers': {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEYHERE'
  },
  body: JSON.stringify({
    "location": "vijayawa"
  })

};
request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});