Taboo Cards REST API with Spring Boot
Summary:
This is simple REST API developed with Spring Boot which allows transactions on taboo cards.
Requirements:
- Java (JDK 17 used)
- PostgreSQL (Version 14 used)
- Intellij IDE (Recommended)
JSON Format:
{
"word": "Hece",
"forbidden": ["Kelime", "Harf", "Ses", "Okumak", "Yazı"]
}
Note: Example JSON file can found in src/main/resources/static/words.json
.
Endpoints Table:
Request URL | Description | HTTP |
---|---|---|
/getCardById/{id} | Returns the card that matches the id. | GET |
/getCard/{word} | Returns the card that matches the word. | GET |
/getRandomCard | Returns a random card. | GET |
/getCards | Returns all cards. | GET |
/addCard | Add card to database. If card already exist in the database, it will be updated with new values. | POST |
/addCards | Add card list to database. If any card in the list already exist in the database, this card will be updated with new values. | POST |
/updateCardById/{id} | Update the card that matches the id. | PUT |
/updateCard/{word} | Update the card that matches the word. | PUT |
/deleteCardById/{id} | Delete the card that matches the id. | DELETE |
/deleteCard/{word} | Delete the card that matches the word. | DELETE |
/deleteCards | Delete all cards. | DELETE |
Example GET Request:
/getCard/Avize
Request: 200 - OK
Response: Response Body:
{
"id": 3,
"word": "Avize",
"forbidden" : ["Lamba", "Kristal", "Tavan", "Işık", "Aydınlık"]
}
Example POST Request:
/addCards
Request: Request Body:
[
{
"word": "Tiyatro",
"forbidden" : ["Oyuncu", "Sahne", "Perde", "Oyun", "Suflör"]
},
{
"word": "Kedi",
"forbidden" : ["Pati", "Fare", "Tüy", "Kuyruk", "Hayvan"]
}
]
201 - CREATED
Response: Response Body:
[
{
"id": 1,
"word": "Tiyatro",
"forbidden" : ["Oyuncu", "Sahne", "Perde", "Oyun", "Suflör"]
},
{
"id": 2,
"word": "Kedi",
"forbidden" : ["Pati", "Fare", "Tüy", "Kuyruk", "Hayvan"]
}
]
Alperen Cubuk