The Moon Phase API delivers precise and real-time data on the lunar phases. It provides developers with detailed information on the current phase of the moon, forecasts of upcoming lunar cycles, and access to historical moon phase data. This API is structured to be user-friendly and straightforward to incorporate into various applications, catering to needs in astronomy, navigation, and lifestyle enhancements.
To start using the Moon Phase API, you will need to include the following headers in your requests to authenticate and receive responses.
https://luna-phase.p.rapidapi.com/Luna_Phase
Your_API_Key_Here
- Replace with your personal API key.luna-phase.p.rapidapi.com
Hereโs how you can make a request to the Moon Phase API using Python:
import requests
# Endpoint URL
url = "https://luna-phase.p.rapidapi.com/Luna_Phase"
# Parameters for the API request
querystring = {"lat":"51.5074","lon":"-0.1278","timestamp":"1713685356"}
# Headers with API authentication keys
headers = {
"X-RapidAPI-Key": "Your_API_Key_Here",
"X-RapidAPI-Host": "luna-phase.p.rapidapi.com"
}
# Sending the GET request
response = requests.get(url, headers=headers, params=querystring)
# Printing the response
print(response.json())
Here is an example of a typical JSON response providing lunar phase data:
{
"Phase_Description": "Waxing Gibbous",
"Phase": 93.56277465820312
}
For further assistance or additional information, please refer to our comprehensive API documentation or contact our support team.