Testing Panchang API - Find Choghadiya API Using Postman

The Find Choghadiya API is a critical component of the Panchang API suite, offering detailed Choghadiya timings for any given day. Choghadiya, an ancient Vedic astrological method, divides the day and night into auspicious and inauspicious intervals, helping individuals to plan their activities accordingly. This API provides the start and end times of each Choghadiya period, categorized as Labh (Gain), Amrit (Nectar), Kaal (Death), Shubh (Auspicious), Rog (Disease), Udveg (Anxiety), and Char (Move), based on the provided date and geographical coordinates.

 Last updated : 12 Dec, 2024
 Guide

1. Securing Your API Key

To start, you need an API key. Head over to https://divineapi.com/ and register to initiate your 7-day trial.

  • Select the APIs you are interested in; you can change these selections at any time. You can add or remove APIs in the future.
  • Click on checkout, fill out the sign-up form, and enter your payment details on the next page.

Your trial will begin immediately. You won't be charged during the trial period, and you can cancel anytime without incurring any charges.

  • After logging in, your API key will be visible on your dashboard on the API Key page ( https://divineapi.com/api-keys)

 

2. Importing the Postman Collection

Import our Postman collection to facilitate your API testing:

  • After logging into your Postman account:
  • Open This link: https://documenter.getpostman.com/view/27195761/2sA3Qs8rfV 
  • Click “Run in Postman” and then select “Run in Web”.
  • Select your workspace and then select ‘import’.

 

3. Configuring Your API Request

Once the collection is imported:

  • Locate the "Find Choghadiya" API request.
  • Ensure the method is set to POST.
  • Use this request URL: https://astroapi-2.divineapi.com/indian-api/v1/find-choghadiya 

 

4. Setting Request Parameters

This API call necessitates only your API key. To find your API key.

  • Go to your DivineAPI dashboard > API Key page.
  • Click on “Copy” next to the API key

 Notice the difference between the key, and the Access Token.

 

Go back to Postman to set the parameters.

  • Navigate to “Authorization”, select “Bearer Token” in the Auth type, and then add the token from your Divine API profile.
  • Navigate to 'Body', select 'form_data', and then add:
    • api_key: “<Your_API_Key>” - Your unique API subscription identifier.
    • day: “24” - Enter the date of birth.
    • month: “05” - Enter the month of birth.
    • year: "2023" - The year of interest.
    • place: "New Delhi" - The name of the city.
    • lat: "28.6139" - Latitude for location-specific details.
    • lon: "77.2090" - Longitude for accurate location insights.
    • tzone: "5.5" - Timezone offset from UTC.
    • lan: “en” - Enter the language.
  • Please ensure that the bearer token is exactly the same as in your profile, with no changes in spacing or formatting.

 

5. Making the Request

Hit the 'Send' button to submit your request.

 

6. Deciphering the Response

The API's response will be structured as follows:

{

{
    "success": 1,
    "data": {
        "day_choghadiyas": {
            "Labh": "05:26 AM to 07:09 AM",
            "Amrit": "07:09 AM to 08:52 AM",
            "Kaal": "08:52 AM to 10:35 AM",
            "Shubh": "10:35 AM to 12:18 PM",
            "Rog": "12:18 PM to 02:01 PM",
            "Udveg": "02:01 PM to 03:44 PM",
            "Char": "03:44 PM to 05:27 PM",
            "Next Labh": "05:27 PM to 07:10 PM"
        },
        "night_choghadiyas": {
            "Udveg": "07:10 PM to 08:27 PM",
            "Shubh": "08:27 PM to 09:44 PM",
            "Amrit": "09:44 PM to 11:01 PM",
            "Char": "11:01 PM to 12:18 AM May 25",
            "Rog": "12:18 AM to 01:35 AM May 25",
            "Kaal": "01:35 AM to 02:52 AM May 25",
            "Labh": "02:52 AM to 04:09 AM May 25",
            "Next Udveg": "04:09 AM to 05:26 AM May 25"
        }
    }
}
  • The Find Choghadiya API response provides auspicious and inauspicious time periods for both day and night. 
  • The "day_choghadiyas" and "night_choghadiyas" objects contain keys representing different Choghadiya periods (e.g., "Labh," "Amrit," "Kaal"), with corresponding time ranges. 
  • Use these fields to display the specific time slots for each Choghadiya throughout the day and night.

7. Error Resolution

Ensure your API key is correctly entered if you encounter errors, as most issues are due to invalid or missing API keys.

8. Further Assistance

For additional support or inquiries, feel free to contact our customer service team at admin@divineapi.com.