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 | 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/sunrise';
var userId = '<Your User Id>';
var apiKey = '<Your Api Key>';
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'
},
data:JSON.stringify(data)
});
request.then( function(resp){
console.log(resp);
}, function(err){
console.log(err);
});