AstrologyAPI

Chinese Zodiac

POSThttps://json.astrologyapi.com/v1/chinese_zodiac
Copy

POST/chinese_zodiac
Copy
1import requests
2import json
3
4# Your API key
5api_key = "<YOUR_API_KEY>"
6
7# API endpoint URL
8api_url = "https://json.astrologyapi.com/v1/chinese_zodiac"
9
10# Request data
11data = {
12        "day": 10,
13        "month": 5,
14        "year": 1990,
15        "hour": 19,
16        "min": 55,
17        "lat": 19.2056,
18        "lon": 25.2056,
19        "tzone": 5.5
20    }
21
22headers = {
23    'x-astrologyapi-key': api_key,
24    'Content-Type': 'application/json'
25    # Add 'Accept-Language': '<language_code>' if needed
26}
27
28try:
29    response = requests.post(api_url, headers=headers, json=data)
30    response.raise_for_status()  # Raise an exception for bad status codes (4xx or 5xx)
31
32    # Process the response
33    response_data = response.json()
34    print(json.dumps(response_data, indent=4))
35
36except requests.exceptions.RequestException as e:
37    print(f"Error making API request: {e}")
38    if hasattr(e, 'response') and e.response is not None:
39        try:
40            print(f"Error response: {e.response.json()}")
41        except json.JSONDecodeError:
42             print(f"Error response (non-JSON): {e.response.text}")
43
44
200Response
Copy
1"{\n    \"name\": \"Rabbit\",\n    \"force\": \"Yin\",\n    \"element\": \"Wood\",\n    \"hours_ruled\": \"5 AM - 7 AM\",\n    \"best_compatibility\": \"Sheep, Pig\",\n    \"worst_compatibility\": \"Rat, Dragon, Ox, Rooster\",\n    \"color\": \"White\",\n    \"positive_traits\": \"Affectionate, Ambitious, Artistic, Considerate, Cultured\",\n    \"negative_traits\": \"Complicated, Conformist, Conservative, Gossipy, Hesitant\",\n    \"report\": [\n        \"You have a very good judgement and refined creativity. You are a kind and helpful friend. The virtuous you possesses a highly developed sense of justice and fairness. Peace at all costs is essential for your creative flow. All the life the lesson to be learned is \"detachment\" . A Rabbit's home is always beautiful because you are famous for your artistic sense and good taste. You are also well dressed. You like to throw lavish parties. You definitely possess the most expensive closet full of beautiful and branded clothes. You prefer your own company or the company of a select handful of close friends.\",\n        \"Even though you are popular and loved by your friends and family, Rabbit people are pessimistic under the surface. You are sympathetic and truly soft at heart which makes you a famous socially. You are polite and gracious, and no one has such impeccable manners. Incapable of harsh words, you always try hard to keep the peace and make everyone happy. You don't like to argue, and you'd rather enjoy a quiet, peaceful life. You can be very affectionate and obliging, but only to the ones you love. You great sense of humor and is good at giving practical advice. You can be a wonderful hostess, and whenever you are a guest at a party, you make yourself at home.\",\n        \"Having an exceptional insight for detailed work, you prefer to keep your own counsel, listen to your intuition and rarely acts on unsolicited advice. You have a remarkable ability to heal from psychological as well as physical wounds. Privacy is important to you, and you're reluctant to reveal things about yourself. You can be very unpredictable, with occasional mood swings that make you hard to understand. But you want to be in a controlled situation more than anything else. Vacation and routines are very important to you, too. You have a sense of timing and know the right time to throw the punch to win the battle without anyone knowing a battle has been fought. As a business partner, you are an intelligent and able person. They have a conservative outlook on life, but your partner will have to convince your to take on risky business. Nevertheless, Rabbits are pros when it comes to negotiation on risky business. With your great negotiation skills and organizing mind, you will do well in business.\"\n    ]\n}"

Request Headers

Authorization

string

required

Basic Authorization via header

Accept-Language

string

Preferred language for the response content

Properties

English - en

Request Parameters

day

int

required

Date of birth, eg: 10

month

int

required

Month of birth, eg: 5

year

int

required

Year of birth, eg: 1990

hour

int

required

Hour of birth, eg: 19

min

int

required

Minute of birth, eg: 55

lat

float

required

Latitude, eg: 19.2056

lon

float

required

Longitude, eg: 25.2056

tzone

float

required

Timezone, eg: 5.5

Errors

400
Bad Request

Something is wrong with your request format or parameters.

401
Unauthorized

Your API key is missing or invalid.

403
Forbidden

You don't have permission to access this specific resource.

404
Not Found

The API endpoint you're trying to reach doesn't exist.

500
Internal Server Error

Our server is having a temporary glitch.