Geo Location

API Endpoint:

geo-details

Method:

POST

Full URL:

https://json.freeastrologyapi.com/geo-details


Request data
Parameter Data type Description
location String Location name, eg: Hyderabad


Sample Payload


    
{
    "location":"New Delhi"
}
    
    


Sample Code





$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":"New Delhi"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json',
    'x-api-key: YOUR_API_KEY_HERE'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;



import requests
import json

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

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

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

print(response.text)


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_KEY_HERE'
  },
  body: JSON.stringify({
    "location": "New Delhi"
  })

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



Response data

    
[
    {
        "location_name": "New Delhi",
        "longitude": 77.22445,
        "latitude": 28.63576,
        "timezone_offset": 5.5,
        "timezone": "Asia/Kolkata",
        "complete_name": "New Delhi, New Delhi, Delhi, India",
        "country": "India",
        "administrative_zone_1": "Delhi",
        "administrative_zone_2": "New Delhi"
    }
]