### Puja Suggestion API Request Example (JavaScript) Source: https://astrologyapi.com/docs/api-ref/57/puja_suggestion Example of how to make a POST request to the Puja Suggestion API using JavaScript's Fetch API. It includes setting the request body with user's birth details and the 'Accept-Language' header for language preference. ```javascript const apiUrl = "https://json.astrologyapi.com/v1/puja_suggestion"; const apiKey = "YOUR_API_KEY"; // Replace with your actual API key const requestBody = { "day": 10, "month": 5, "year": 1990, "hour": 19, "min": 55, "lat": 19.2056, "lon": 25.2056, "tzone": 5.5 }; fetch(apiUrl, { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${apiKey}`, "Accept-Language": "en" // Change to 'hi', 'ma', 'bn', 'ta', 'te', 'ml', 'kn' for other languages }, body: JSON.stringify(requestBody) }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error("Error fetching puja suggestions:", error); }); ``` -------------------------------- ### Puja Suggestion API Response Example (JSON) Source: https://astrologyapi.com/docs/api-ref/57/puja_suggestion Example JSON response from the Puja Suggestion API. It contains a summary of the suggestions and a detailed list of recommended pujas, including their status, priority, title, ID, summary, and a one-line recommendation. ```json { "summary": "Following are the puja suggestions based on your horoscope and planetary combinations.", "suggestions": [ { "status": true, "priority": 5, "title": "Kal Sarpa Dosha Shanti Pujan", "puja_id": "KAL_SARPA", "summary": "If all the 7 planets are situated between Rahu and Ketu then Kaal Sarp Yog is formed.According to the situation of Rahu in 12 houses of horoscope there are Kaal Sarp Yogas of 12 types. These are : 1. Anant, 2. Kulik, 3. Vasuki, 4. Shankhpal, 5. Padma, 6. Mahapadma, 7. Takshak, 8. Karkotak, 9. Shankhchud, 10. Ghaatak, 11. Vishdhar and 12. Sheshnag. The Kaal Sarp Yog is of two types- Ascending and Descending. If all the 7 planets are eaten away by Rahus mouth then it is Ascending Kaal Sarp Yog. If all planets are situated in back of Rahu then Descending Kaal Sarp Yog is formed.", "one_line": "You have ascending kalsarpa dosha direction, which is treated as powerful. The KalSarpa Dosha is having partial effect in your horoscope." }, { "status": true, "priority": 3, "title": "Nakshatra Pujan", "puja_id": "NAKSHATRA_PUJA", "summary": "Moon nakshatra is one of the most important nakshatra is horoscope. In horoscope, fifth, seventh and ninth houses are for children, life partner and luck respectively. And if their lords are in vedha (obstructive position) with Moon naksahtra then various hardships might be faced in your life. To reduce the effect of obsctructions and make your constellations in sync with other house lords, Nakshatra Puja is recommended.", "one_line": "Ninth house lord is in VIPAT vedha with your Moon nakshatra and therefore it is recommended that you perform nakshatra puja to mitigate evil effects of vedha." } ] } ``` -------------------------------- ### Sub Char Dasha API Request Example Source: https://astrologyapi.com/docs/api-ref/63/sub_chardasha Example of how to make a POST request to the Sub Char Dasha API. This snippet demonstrates the required request body parameters for date of birth, location, and timezone, along with the API endpoint and headers. ```curl curl -X POST https://json.astrologyapi.com/v1/sub_chardasha/:md \ -H "Accept-Language: en" \ -H "Content-Type: application/json" \ -d '{ "day": 10, "month": 5, "year": 1990, "hour": 19, "min": 55, "lat": 19.2056, "lon": 25.2056, "tzone": 5.5 }' ``` -------------------------------- ### Major Yogini Dasha API Response Data Example Source: https://astrologyapi.com/docs/api-ref/58/major_yogini_dasha This is an example of the JSON response structure for the Major Yogini Dasha API. It includes dasha details such as ID, name, start and end dates (both in string and millisecond formats), and duration. ```json [ { "dasha_id": 1, "dasha_name": "Pingla", "start_date": "9-11-2000 5:9", "end_date": "9-11-2002 5:9", "start_ms": 973726740000, "end_ms": 1036798740000, "duration": 2 }, { "dasha_id": 2, "dasha_name": "Dhanya", "start_date": "9-11-2002 5:9", "end_date": "9-11-2005 5:9", "start_ms": 1036798740000, "end_ms": 1131493140000, "duration": 3 } ] ``` -------------------------------- ### Basic Gemstone Suggestions API Integration in JavaScript Source: https://astrologyapi.com/docs/api-ref/32/basic_gem_suggestion Demonstrates how to integrate the Basic Gemstone Suggestions API using JavaScript. It shows how to set up the request with user credentials, astrological data, and language preferences, and how to handle the API response. ```javascript var api = 'basic_gem_suggestion'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Get Favourable Time (Numero Fav Time) - PHP Source: https://astrologyapi.com/docs/api-ref/47/numero_fav_time This PHP snippet illustrates how to invoke the 'numero_fav_time' API for retrieving favourable time predictions. It includes setting up the API endpoint, authentication headers, and request data, similar to the JavaScript example. ```php // PHP Example (Conceptual, requires cURL or similar library for actual implementation) $api = 'numero_fav_time'; $userId = ''; $apiKey = ''; $language = ''; // By default it is set to en $data = [ 'day' => 6, 'month' => 1, 'year' => 2000, 'name' => "Kevin" ]; $auth = base64_encode($userId . ':' . $apiKey); $url = "https://json.astrologyapi.com/v1/" . $api; $headers = [ 'Authorization: Basic ' . $auth, 'Content-Type: application/json', 'Accept-Language: ' . $language ]; // Using cURL to make the POST request $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Error:' . curl_error($ch); } else { $responseData = json_decode($response, true); print_r($responseData); } certify_setopt($ch, CURLOPT_CLOSE, true); ``` -------------------------------- ### POST Request for Lalkitab Houses API in JavaScript Source: https://astrologyapi.com/docs/api-ref/149/lalkitab_houses This JavaScript code snippet demonstrates how to make a POST request to the Lalkitab Houses API using jQuery AJAX. It includes setting up API credentials, request headers for authentication and language, and sending date and location data. The response is logged to the console. ```javascript var api = 'lalkitab_houses'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Match Manglik Report API Request (JavaScript) Source: https://astrologyapi.com/docs/api-ref/12/match_manglik_report This snippet demonstrates how to make a POST request to the match_manglik_report API endpoint using JavaScript. It includes setting up authentication headers, request payload with birth details, and handling the API response. Ensure you replace placeholder values for User ID and API Key. ```javascript var api = 'match_manglik_report'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Astrology API Data Structure Example Source: https://astrologyapi.com/docs/api-ref/59/sub_yogini_dasha This JSON object represents the data structure returned by the Astrology API for astrological calculations, specifically showing dasha (planetary periods) information. It includes details like dasha names, start and end dates in both string and millisecond formats. ```json { "sub_yogini_dasha": [ { "dasha_id": 0, "dasha_name": "Pingla", "start_date": "8-11-2065 17:9", "end_date": "20-4-2066 1:9", "start_ms": 3024905940000, "end_ms": 3038931540000 }, { "dasha_id": 2, "dasha_name": "Dhanya", "start_date": "20-4-2066 1:9", "end_date": "19-12-2066 13:9", "start_ms": 3038931540000, "end_ms": 3059969940000 }, { "dasha_id": 3, "dasha_name": "Bhramari", "start_date": "19-12-2066 13:9", "end_date": "9-11-2067 5:9", "start_ms": 3059969940000, "end_ms": 3088021140000 }, { "dasha_id": 4, "dasha_name": "Bhadrika", "start_date": "9-11-2067 5:9", "end_date": "19-12-2068 1:9", "start_ms": 3088021140000, "end_ms": 3123085140000 }, { "dasha_id": 5, "dasha_name": "Ulka", "start_date": "19-12-2068 1:9", "end_date": "20-4-2070 1:9", "start_ms": 3123085140000, "end_ms": 3165161940000 }, { "dasha_id": 6, "dasha_name": "Siddha", "start_date": "20-4-2070 1:9", "end_date": "9-11-2071 5:9", "start_ms": 3165161940000, "end_ms": 3214251540000 } ] }, { "major_dasha": { "dasha_id": 0, "dasha_name": "Mangla", "start_date": "9-11-2071 5:9", "end_date": "9-11-2072 5:9", "start_ms": 3214251540000, "end_ms": 3245873940000, "duration": 1 }, "sub_dasha": [ { "dasha_id": 0, "dasha_name": "Mangla", "start_date": "9-11-2071 5:9", "end_date": "19-11-2071 8:39", "start_ms": 3214251540000, "end_ms": 3215128140000 }, { "dasha_id": 1, "dasha_name": "Pingla", "start_date": "19-11-2071 8:39", "end_date": "9-12-2071 15:39", "start_ms": 3215128140000, "end_ms": 3216881340000 }, { "dasha_id": 2, "dasha_name": "Dhanya", "start_date": "9-12-2071 15:39", "end_date": "9-1-2072 2:9", "start_ms": 3216881340000, "end_ms": 3219511140000 }, { "dasha_id": 3, "dasha_name": "Bhramari", "start_date": "9-1-2072 2:9", "end_date": "18-2-2072 16:9", "start_ms": 3219511140000, "end_ms": 3223017540000 }, { "dasha_id": 4, "dasha_name": "Bhadrika", "start_date": "18-2-2072 16:9", "end_date": "9-4-2072 9:39", "start_ms": 3223017540000, "end_ms": 3227400540000 }, { "dasha_id": 5, "dasha_name": "Ulka", "start_date": "9-4-2072 9:39", "end_date": "9-6-2072 6:39", "start_ms": 3227400540000, "end_ms": 3232660140000 }, { "dasha_id": 6, "dasha_name": "Siddha", "start_date": "9-6-2072 6:39", "end_date": "19-8-2072 7:9", "start_ms": 3232660140000, "end_ms": 3238796340000 }, { "dasha_id": 7, "dasha_name": "Sankata", "start_date": "19-8-2072 7:9", "end_date": "9-11-2072 5:9", "start_ms": 3238796340000, "end_ms": 3245873940000 } ] } ] } ``` -------------------------------- ### Varshaphal Mudda Dasha API Response Example Source: https://astrologyapi.com/docs/api-ref/84/varshaphal_mudda_dasha The response from the varshaphal_mudda_dasha API contains an array of objects, each representing a planetary dasha. Each object includes the planet's name, its duration in the sequence, and the exact start and end timestamps of its dasha period. ```json [ { "planet": "SUN", "duration": 18, "dasha_start": "3-2-2017,12:37:41", "dasha_end": "21-2-2017,18:55:41" }, { "planet": "MOON", "duration": 30, "dasha_start": "21-2-2017,18:55:41", "dasha_end": "24-3-2017,5:25:41" }, { "planet": "MARS", "duration": 21, "dasha_start": "24-3-2017,5:25:41", "dasha_end": "14-4-2017,12:46:41" }, { "planet": "RAHU", "duration": 54, "dasha_start": "14-4-2017,12:46:41", "dasha_end": "8-6-2017,7:40:41" }, { "planet": "JUPITER", "duration": 48, "dasha_start": "8-6-2017,7:40:41", "dasha_end": "27-7-2017,0:28:41" }, { "planet": "SATURN", "duration": 57, "dasha_start": "27-7-2017,0:28:41", "dasha_end": "22-9-2017,20:25:41" }, { "planet": "MERCURY", "duration": 51, "dasha_start": "22-9-2017,20:25:41", "dasha_end": "13-11-2017,14:16:41" }, { "planet": "KETU", "duration": 21, "dasha_start": "13-11-2017,14:16:41", "dasha_end": "4-12-2017,21:37:41" }, { "planet": "VENUS", "duration": 60, "dasha_start": "4-12-2017,21:37:41", "dasha_end": "3-2-2018,18:37:41" } ] ``` -------------------------------- ### Pitra Dosha Report API Request Example (JavaScript) Source: https://astrologyapi.com/docs/api-ref/56/pitra_dosha_report This JavaScript snippet shows how to call the Pitra Dosha Report API using the `fetch` API. It outlines the necessary request method, headers, and the JSON body containing birth details for the horoscope analysis. ```javascript const apiUrl = "https://json.astrologyapi.com/v1/pitra_dosha_report"; const headers = { "Accept-Language": "en", "Content-Type": "application/json" }; const data = { "day": 10, "month": 5, "year": 1990, "hour": 19, "min": 55, "lat": 19.2056, "lon": 25.2056, "tzone": 5.5 }; fetch(apiUrl, { method: "POST", headers: headers, body: JSON.stringify(data) }) .then(response => { if (!response.ok) { throw new Error(`HTTP error! status: ${response.status}`); } return response.json(); }) .then(data => { console.log(data); }) .catch(error => { console.error("Error fetching data:", error); }); ``` -------------------------------- ### Match Astro Details API (POST Request Example) Source: https://astrologyapi.com/docs/api-ref/8/match_astro_details This snippet demonstrates how to make a POST request to the match_astro_details API endpoint to retrieve astrological details for a male and female. It includes sample request parameters for birth dates, times, and locations. The response provides detailed astrological information. ```javascript const fetch = require('node-fetch'); async function matchAstroDetails() { const url = 'https://json.astrologyapi.com/v1/match_astro_details'; const headers = { 'Accept-Language': 'en', 'Content-Type': 'application/json' }; const body = JSON.stringify({ m_day: 10, m_month: 5, m_year: 1990, m_hour: 11, m_min: 55, m_lat: 19.2056, m_lon: 25.2056, m_tzone: 5.5, f_day: 10, f_month: 5, f_year: 1990, f_hour: 11, f_min: 55, f_lat: 19.2056, f_lon: 25.2056, f_tzone: 5.5 }); try { const response = await fetch(url, { method: 'POST', headers: headers, body: body }); const data = await response.json(); console.log(data); } catch (error) { console.error('Error:', error); } } matchAstroDetails(); ``` -------------------------------- ### Get Next Day Nakshatra Prediction - API Request Example Source: https://astrologyapi.com/docs/api-ref/105/daily_nakshatra_prediction/next This snippet demonstrates how to make a POST request to the daily_nakshatra_prediction/next endpoint to retrieve the next day's Nakshatra prediction. It requires specific date and location parameters and supports language selection via the 'Accept-Language' header. ```javascript fetch('https://json.astrologyapi.com/v1/daily_nakshatra_prediction/next', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Accept-Language': 'en' }, body: JSON.stringify({ "day": 10, "month": 5, "year": 1990, "hour": 19, "min": 55, "lat": 19.2056, "lon": 25.2056, "tzone": 5.5 }) }) .then(response => response.json()) .then(data => console.log(data)) .catch(error => console.error('Error:', error)); ``` -------------------------------- ### Match Planet Details API POST Request (PHP) Source: https://astrologyapi.com/docs/api-ref/9/match_planet_details This PHP snippet illustrates how to send a POST request to the 'match_planet_details' endpoint. It constructs the API URL, prepares the request data including birth details and credentials, and sets the necessary headers for authentication and content type. The example uses cURL to handle the HTTP request and includes error handling. ```php '; $apiKey = ''; $language = ''; // By default it is set to en $data = [ 'm_day' => 6, 'm_month' => 1, 'm_year' => 2000, 'm_hour' => 7, 'm_min' => 45, 'm_lat' => 19.132, 'm_lon' => 72.342, 'm_tzone' => 5.5, 'f_day' => 6, 'f_month' => 1, 'f_year' => 2000, 'f_hour' => 7, 'f_min' => 45, 'f_lat' => 19.132, 'f_lon' => 72.342, 'f_tzone' => 5.5, ]; $auth = base64_encode($userId . ':' . $apiKey); $url = "https://json.astrologyapi.com/v1/" . $api; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "authorization: Basic " . $auth, "Content-Type: application/json", "Accept-Language: " . $language ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { echo $response; } curl_close($ch); ?> ``` -------------------------------- ### Get Antar Dasha by Major Dasha (Vimshottari Dasha) Source: https://astrologyapi.com/docs/api-ref/98/sub_vdasha/%3Amd This API retrieves the Antar Dasha (sub-period) based on the Major Dasha for a given birth date and location. It requires user authentication and accepts date, time, and geographical coordinates. The response includes the start and end times for each planetary sub-period. ```JavaScript var api = 'sub_vdasha/:md'; var userId = ''; var apiKey = ''; var 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); }); ``` ```PHP '; $apiKey = ''; $language = ''; // By default it is set to en $data = [ 'day' => 6, 'month' => 1, 'year' => 2000, 'hour' => 7, 'min' => 45, 'lat' => 19.132, 'lon' => 72.342, 'tzone' => 5.5, ]; $headers = [ 'Authorization: Basic ' . base64_encode($userId . ':' . $apiKey), 'Content-Type: application/json', 'Accept-Language: ' . $language ]; $ch = curl_init('https://json.astrologyapi.com/v1/sub_vdasha/:md'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { echo 'HTTP Status Code: ' . $httpCode . "\n"; echo 'Response: ' . $response; } curl_close($ch); ?> ``` -------------------------------- ### Get Sunrise Data via POST - Javascript Source: https://astrologyapi.com/docs/api-ref/111/panchang_chart/sunrise This snippet shows how to make a POST request to the panchang_chart/sunrise endpoint using Javascript. It includes setting up authentication with User ID and API Key, defining request data such as date, time, and location, and handling the response. Ensure you have jQuery ($.ajax) available for this example. ```javascript var api = 'panchang_chart/sunrise'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Make POST Request - Astrology API (PHP) Source: https://astrologyapi.com/docs/api-ref/94/bhav_madhya This PHP code snippet illustrates how to make a POST request to the Astrology API. It constructs the API endpoint URL, sets up authentication using Basic Auth with Base64 encoding, and sends the birth data in JSON format. Error handling and response logging are included. ```php '; $apiKey = ''; $language = ''; // By default it is set to en $data = [ 'day' => 6, 'month' => 1, 'year' => 2000, 'hour' => 7, 'min' => 45, 'lat' => 19.132, 'lon' => 72.342, 'tzone' => 5.5, ]; $auth = base64_encode($userId . ':' . $apiKey); $url = "https://json.astrologyapi.com/v1/" . $api; $headers = [ "authorization: Basic " . $auth, "Content-Type: application/json", "Accept-Language: " . $language ]; $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } else { $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE); if ($httpcode >= 200 && $httpcode < 300) { echo "Response: "; echo $response; } else { echo "Error: HTTP code " . $httpcode . ", Response: " . $response; } } curl_close($ch); ?> ``` -------------------------------- ### Match Dashakoot Points API POST Request Example Source: https://astrologyapi.com/docs/api-ref/119/match_dashakoot_points This snippet demonstrates how to make a POST request to the match_dashakoot_points API endpoint to get astrological matching points for a couple. It requires detailed birth information for both individuals and includes optional headers for language selection. The response provides a breakdown of points for each of the ten koots, along with the total match score. ```shell curl -X POST \ https://json.astrologyapi.com/v1/match_dashakoot_points \ -H 'Accept-Language: en' \ -H 'Content-Type: application/json' \ -d '{ "m_day": 10, "m_month": 5, "m_year": 1990, "m_hour": 11, "m_min": 55, "m_lat": 19.2056, "m_lon": 25.2056, "m_tzone": 5.5, "f_day": 10, "f_month": 5, "f_year": 1990, "f_hour": 11, "f_min": 55, "f_lat": 19.2056, "f_lon": 25.2056, "f_tzone": 5.5 }' ``` -------------------------------- ### Fetch All Current Vdasha Data via POST Request (JavaScript) Source: https://astrologyapi.com/docs/api-ref/24/current_vdasha_all This JavaScript snippet demonstrates how to make a POST request to the 'current_vdasha_all' endpoint of the AstrologyAPI. It includes setting up API credentials, request data (date, time, location), and authentication headers. The response is logged to the console, with error handling also included. It requires the jQuery library for AJAX requests. ```javascript var api = 'current_vdasha_all'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Match Making Detailed Report API Request (JavaScript) Source: https://astrologyapi.com/docs/api-ref/118/match_making_detailed_report This JavaScript code demonstrates how to make a POST request to the Match Making Detailed Report API. It includes setting up authentication headers, request payload with birth details, and handling the response. ```javascript var api = 'match_making_detailed_report'; var userId = ''; var apiKey = ''; var language = '' // By default it is set to en var data = { m_day: 6, m_month: 1, m_year: 2000, m_hour: 7, m_min: 45, m_lat: 19.132, m_lon: 72.342, m_tzone: 5.5, f_day: 6, f_month: 1, f_year: 2000, f_hour: 7, f_min: 45, f_lat: 19.132, f_lon: 72.342, f_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); }); ``` -------------------------------- ### Get Rudraksha Suggestion (JavaScript) Source: https://astrologyapi.com/docs/api-ref/34/rudraksha_suggestion This JavaScript code snippet demonstrates how to call the rudraksha_suggestion API to get personalized Rudraksha recommendations. It requires user ID, API key, and birth details as input. The API returns the recommended Rudraksha combination, image URL, and its benefits. ```JavaScript var api = 'rudraksha_suggestion'; var userId = ''; var apiKey = ''; var 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); }); ``` -------------------------------- ### Advanced Panchang for Sunrise Source: https://astrologyapi.com/docs/api-ref/20/advanced_panchang/sunrise This API provides detailed information related to sunrise, sunset, moonrise, moonset, tithi, nakshatra, yog, karan, paksha, ritu, sun sign, moon sign, ayana, vikram_samvat, shaka_samvat, disha_shool, nak_shool, moon_nivas, abhijit_muhurta, rahukaal, guliKaal, and yamghant_kaal for a given date and location. ```APIDOC ## POST /advanced_panchang/sunrise ### Description Provides detailed astrological information including sunrise, sunset, moon phases, and various timings for a specific date and location. ### Method POST ### Endpoint /advanced_panchang/sunrise ### Parameters #### Query Parameters - **Accept-Language** (string) - Optional - Specifies the language for the response. Supported values: en, hi, ma, bn, ta, te, ml, kn. #### Request Body - **day** (int) - Required - The day of the month (e.g., 10). - **month** (int) - Required - The month of the year (e.g., 5). - **year** (int) - Required - The year (e.g., 1990). - **hour** (int) - Required - The hour of the day (e.g., 19). - **min** (int) - Required - The minute of the hour (e.g., 55). - **lat** (float) - Required - The latitude of the location (e.g., 19.2056). - **lon** (float) - Required - The longitude of the location (e.g., 25.2056). - **tzone** (float) - Required - The timezone offset (e.g., 5.5). ### Request Example ```json { "day": 10, "month": 5, "year": 1990, "hour": 19, "min": 55, "lat": 19.2056, "lon": 25.2056, "tzone": 5.5 } ``` ### Response #### Success Response (200) - **sunrise** (object) - Details about sunrise. - **sunset** (object) - Details about sunset. - **moonrise** (object) - Details about moonrise. - **moonset** (object) - Details about moonset. - **tithi** (object) - Details about the tithi. - **nakshatra** (object) - Details about the nakshatra. - **yog** (object) - Details about the yog. - **karan** (object) - Details about the karan. - **paksha** (string) - The paksha (lunar day). - **ritu** (string) - The season. - **sun_sign** (string) - The sun sign. - **moon_sign** (string) - The moon sign. - **ayana** (string) - The ayana. - **vikram_samvat** (string) - The Vikram Samvat year. - **shaka_samvat** (string) - The Shaka Samvat year. - **disha_shool** (string) - Disha Shool information. - **nak_shool** (string) - Nakshool information. - **moon_nivas** (string) - Moon Nivas information. - **abhijit_muhurta** (object) - Details about Abhijit Muhurta. - **rahukaal** (object) - Details about Rahukaal. - **guliKaal** (object) - Details about Gulikaal. - **yamghant_kaal** (object) - Details about Yamghant Kaal. #### Response Example ```json { "sunrise": { "hour": 6, "min": 15, "azimuth": 80.5 }, "sunset": { "hour": 18, "min": 45, "azimuth": 280.5 }, "moonrise": { "hour": 22, "min": 30, "azimuth": 150.2 }, "moonset": { "hour": 10, "min": 0, "azimuth": 100.8 }, "tithi": { "tithi_name": "Dashami", "start_time": "08:00", "end_time": "19:00" }, "nakshatra": { "nak_name": "Ashwini", "start_time": "05:00", "end_time": "17:00" }, "yog": { "yog_name": "Vyatipata", "start_time": "10:00", "end_time": "21:00" }, "karan": { "karan_name": "Gara", "start_time": "08:00", "end_time": "13:30" }, "paksha": "Shukla Paksha", "ritu": "Vasant", "sun_sign": "Taurus", "moon_sign": "Aries", "ayana": "Uttarayana", "vikram_samvat": "2079", "shaka_samvat": "1944", "disha_shool": "South", "nak_shool": "South", "moon_nivas": "East", "abhijit_muhurta": { "start_time": "11:40", "end_time": "12:30" }, "rahukaal": { "start_time": "12:00", "end_time": "13:30" }, "guliKaal": { "start_time": "09:00", "end_time": "10:30" }, "yamghant_kaal": { "start_time": "15:00", "end_time": "16:30" } } ``` ``` -------------------------------- ### Get Sadhesati Remedies via POST Request (Javascript) Source: https://astrologyapi.com/docs/api-ref/55/sadhesati_remedies This snippet demonstrates how to make a POST request to the AstrologyAPI to fetch sadhesati remedies. It requires user ID, API key, language, and astrological data (day, month, year, hour, min, lat, lon, tzone). The response is logged to the console. ```javascript var api = 'sadhesati_remedies'; var userId = ''; var apiKey = ''; var 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); }); ```