The basic_panchang API returns information about the Hindu calendar system for a given date, including the day of the week, lunar day, lunar mansion, lunar yoga, and the time of sunrise and sunset.
1. Panchang at specified date and time
Here, following APIs are used and date and time along with latitude, longitude and timezone are expected -
Params | Data type | Descriptions |
day required month required year required hour required min required lat required lon required tzone required | int int int int int float float float | panchang day, eg: 10 panchang month, eg: 7 panchang year, eg: 2014 panchang hour, eg: 10 panchang minute, eg: 12 panchang place latitude, eg: 18.7250 panchang place longitude, eg: 72.250 panchang place timezone, eg: 5.5 |
{
"day": "Wednesday",
"tithi": "Shukla-Ashtami",
"yog": "Vaidhriti",
"nakshatra": "Krittika",
"karan": "Vishti",
"sunrise": "7:3:17",
"sunset": "18:43:38"
}
var api = 'basic_panchang';
var userId = '<Your User Id>';
var apiKey = '<Your Api Key>';
var language = '<Your Language>' // By default it is set to en
var data = {
day: 6,
month: 1,
year: 2000,
hour: 7,
min: 45,
lat: 19.132,
lon: 72.342,
tzone: 5.5,
};
var auth = "Basic " + new Buffer(userId + ":" + apiKey).toString("base64");
var request = $.ajax({
url: "https://json.astrologyapi.com/v1/"+api,
method: "POST",
dataType:'json',
headers: {
"authorization": auth,
"Content-Type":'application/json',
"Accept-Language": language
},
data:JSON.stringify(data)
});
request.then( function(resp){
console.log(resp);
}, function(err){
console.log(err);
});