A simple REST API that calculate and returns a Western πͺπΊ or Chinese π¨π³ astrological sign, based on a user's birthdate.
It supports both standard text and emoji format for zodiac signs.
Base URLs:
http://localhost:8080/api/zodiachttp://localhost:8080/api/v1/zodiac
The API offers four main endpoints to calculate the Chinese and Western zodiac signs, either with or without emoji.
- URL:
/api/zodiac/chinese/{birthdate} - Method:
GET - Description: Returns the Chinese zodiac sign's name, based on the birthdate.
- Parameters:
birthdate: The birthdate inyyyy-MM-ddformat. Example:1990-12-25
- Response:
- Type:
text/plain - Body:
Horse
- Type:
- URL:
/api/zodiac/chinese/{birthdate}/emoji - Method:
GET - Description: Returns the Chinese zodiac sign as an emoji, based on the birthdate.
- Parameters:
birthdate: The birthdate inyyyy-MM-ddformat. Example:1990-12-25
- Response:
- Type:
text/plain - Body:
π
- Type:
- URL:
/api/zodiac/western/{birthdate} - Method:
GET - Description: Returns the Western zodiac sign's name, based on the birthdate.
- Parameters:
birthdate: The birthdate inyyyy-MM-ddformat. Example:1990-12-25
- Response:
- Type:
text/plain - Body:
Capricorn
- Type:
- URL:
/api/zodiac/western/{birthdate}/emoji - Method:
GET - Description: Returns the Western zodiac sign as an emoji, based on the birthdate.
- Parameters:
birthdate: The birthdate inyyyy-MM-ddformat. Example:1990-12-25
- Response:
- Type:
text/plain - Body:
β
- Type:
- 400 Bad Request: If the date format is incorrect or an invalid date is provided.
- 404 Not Found: If no zodiac sign is found for the given date (rarely applicable unless there is an error).
-
Get the Chinese zodiac sign for someone born on December 25, 1990:
- Request:
GET /api/zodiac/chinese/1990-12-25 - Response:
Horse
- Request:
-
Get the Chinese zodiac emoji for someone born on January 1, 2000:
- Request:
GET /api/zodiac/chinese/2000-01-01/emoji - Response:
π
- Request:
-
Get the Western zodiac sign for someone born on December 25, 1990:
- Request:
GET /api/zodiac/western/1990-12-25 - Response:
Capricorn
- Request:
-
Get the Western zodiac emoji for someone born on January 1, 2000:
- Request:
GET /api/zodiac/western/2000-01-01/emoji - Response:
β
- Request:
To start the application, use the following command:
mvn spring-boot:runThe service will be accessible at:
http://localhost:8080/api/zodiachttp://localhost:8080/api/v1/zodiac