Samvat information

API Endpoint:

samvatinfo

Method:

POST

Full URL:

https://json.freeastrologyapi.com/samvatinfo


Request data
Parameter Data type Description
year Integer Year number, eg: 2023
month Integer Month number,with no leading zero eg: 7 or 8
date Integer Day number,with no leading zero eg: 5 or 6
hours Integer hours number,with no leading zero eg: 1 or 2
minutes Integer minutes number,with no leading zero eg: 0 or 1
seconds Integer seconds number,with no leading zero eg: 0 or 1
latitude float latitude number, in the range from -90 to 90
longitude float longitude number, in the range from -180 to 180
timezone float Timezone of birth location, eg: 5.5
observation_point String Either "topocentric" or "geocentric"


Sample Code



$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://json.freeastrologyapi.com/samvatinfo',
  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 =>'{
    "year": 2022,
    "month": 8,
    "date": 11,
    "hours": 6,
    "minutes": 0,
    "seconds": 0,
    "latitude": 17.38333,
    "longitude": 78.4666,
    "timezone": 5.5,
    "config": {
        "observation_point": "topocentric",
        "ayanamsha": "lahiri"
    }
}',
  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/samvatinfo"

payload = json.dumps({
  "year": 2022,
  "month": 8,
  "date": 11,
  "hours": 6,
  "minutes": 0,
  "seconds": 0,
  "latitude": 17.38333,
  "longitude": 78.4666,
  "timezone": 5.5,
  "config": {
    "observation_point": "topocentric",
    "ayanamsha": "lahiri"
  }
})
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/samvatinfo',
  'headers': {
    'Content-Type': 'application/json',
    'x-api-key': 'YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    "year": 2022,
    "month": 8,
    "date": 11,
    "hours": 6,
    "minutes": 0,
    "seconds": 0,
    "latitude": 17.38333,
    "longitude": 78.4666,
    "timezone": 5.5,
    "config": {
      "observation_point": "topocentric",
      "ayanamsha": "lahiri"
    }
  })

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



Response data


{
    "status":"success",
    "timestamp":"2023-03-21 21:36:27",
    "saka_salivahana_number":1944,
    "saka_salivahana_name_number":36,
    "saka_salivahana_year_name":"SubhaKritu",
    "vikram_chaitradi_number":2079,
    "vikram_chaitradi_name_number":50,
    "vikram_chaitradi_year_name":"Nala"
}