Player Management API is a Spring Boot application that provides RESTful endpoints for managing player information. It includes functionality for creating, reading, updating, and deleting players, and utilizes DTOs (Data Transfer Objects) for data transfer between layers.
- Java
- Spring Boot
- Spring Data JPA
- Maven
- Docker
- JDK 17 or higher
- Maven
- Docker Desktop
-
Clone the repository:
git clone https://github.com/DiogoBarrosMartins/newspring cd api
-
Build the project using Maven:
mvn clean install
-
Run the application:
docker compose up -build
-
The application will be available at
http://localhost:8080
.
- URL:
/accounts
- Method:
GET
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
200 OK
- Body:
[ { "id": 1, "username": "john_doe", "password": "password123", "villageIds": [1, 2] }, ... ]
- Status:
- URL:
/accounts/{id}
- Method:
GET
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
200 OK
- Body:
{ "id": 1, "username": "john_doe", "password": "password123", "villageIds": [1, 2] }
- Status:
- URL:
/accounts
- Method:
POST
- Request:
- Headers:
Content-Type: application/json
- Body:
{ "username": "john_doe", "password": "password123" }
- Headers:
- Response:
- Status:
201 Created
- Body:
{ "id": 1, "username": "john_doe", "password": "password123", "villageIds": [] }
- Status:
- URL:
/accounts/{id}
- Method:
PUT
- Request:
- Headers:
Content-Type: application/json
- Body:
{ "username": "john_doe_updated", "password": "newpassword123" }
- Headers:
- Response:
- Status:
200 OK
- Body:
{ "id": 1, "username": "john_doe_updated", "password": "newpassword123", "villageIds": [1, 2] }
- Status:
- URL:
/accounts/{id}
- Method:
DELETE
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
204 No Content
- Body: None
- Status:
- URL:
/accounts/authenticate
- Method:
POST
- Request:
- Headers:
Content-Type: application/json
- Body:
{ "username": "john_doe", "password": "password123" }
- Headers:
- Response:
- Status:
200 OK
- Body:
{ "authenticated": true }
- Status:
- URL:
/villages
- Method:
GET
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
200 OK
- Body:
[ { "id": 1, "name": "Village 1", "accountId": 1 }, ... ]
- Status:
- URL:
/villages/{id}
- Method:
GET
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
200 OK
- Body:
{ "id": 1, "name": "Village 1", "accountId": 1 }
- Status:
- URL:
/villages
- Method:
POST
- Request:
- Headers:
Content-Type: application/json
- Body:
{ "name": "Village 1", "accountId": 1 }
- Headers:
- Response:
- Status:
201 Created
- Body:
{ "id": 1, "name": "Village 1", "accountId": 1 }
- Status:
- URL:
/villages/{id}
- Method:
PUT
- Request:
- Headers:
Content-Type: application/json
- Body:
{ "name": "Updated Village", "accountId": 1 }
- Headers:
- Response:
- Status:
200 OK
- Body:
{ "id": 1, "name": "Updated Village", "accountId": 1 }
- Status:
- URL:
/villages/{id}
- Method:
DELETE
- Request:
- Headers:
Content-Type: application/json
- Body: None
- Headers:
- Response:
- Status:
204 No Content
- Body: None
- Status: