The bacis_panchang/sunrise API provides information about the sunrise time along with other details such as the day, tithi, yog, nakshatra, and karan. The response includes the time of the sunrise and sunset for the given day.
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 | date of birth, eg: 10 month of birth, eg: 5 year of birth, eg: 1990 hour, eg: 19 minute, eg: 55 latitude, eg: 19.2056 longitude, eg: 25.2056 timezone, eg: 5.5 |
{
"day": "Tuesday",
"tithi": "Krishna Dashami",
"nakshatra": "Ashwini",
"yog": "Atigand",
"karan": "Vanija",
"sunrise": "05:10:07",
"sunset": "18:54:25",
"vedic_sunrise": "05:14:15",
"vedic_sunset": "18:50:17"
}
var api = 'basic_panchang/sunrise';
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);
});