Nuestra API REST funciona con autorización "Basic Auth". Para poder realizar operaciones de usuario y administrador se deberá indicar en postman las correspondientes credenciales.
- Credenciales de administrador: admin@gmail.com Contraseña: 123
- Credenciales de usuario: willy@gmail.com Contraseña: 123
En la cabecera se deberá especificar un "content-type" "application/json".
- https://localhost:8443/api/logIn
- GET.
- Vacío.
{
"iduser": 2,
"name": "Willy",
"username": "Willy",
"email": "willy@gmail.com",
"img": null,
"rol": {
"idRol": 2,
"rolDes": "Player"
}
}
- Código: 401 UNAUTHORIZED
- https://localhost:8443/api/logOut
- GET
- Vacío
- True
- 401 UNAUTHORIZED
- https://localhost:8443/api/user/{id}
- GET
- Vacío
-
{ "iduser": 1, "name": "Admin", "username": "Admin", "email": "admin@gmail.com", "img": null, "rol": { "idRol": 1, "rolDes": "ADMIN" }
}
- 400 BAD_REQUEST
- https://localhost:8443/api/user/name={userName}
- GET
- Vacío
-
{ "iduser": 1, "name": "Admin", "username": "Admin", "email": "admin@gmail.com", "img": null, "rol": { "idRol": 1, "rolDes": "ADMIN" }
}
- 400 BAD_REQUEST
- https://localhost:8443/api/user
- POST
-
{ "name": "Noveau", "username": "Noveau", "email": "noveaun@gmail.com", "password": "123", "rol": { "idRol": 2, "rolDes": "USER" }
}
- 201 CREATED (User successfully created)
- 409 CONFLICT (Failed to create user)
- https://localhost:8443/api/user/{id}
- PUT
-
{ "user": { }, "player": { "description": "I like football and flying" } } Este body se compone de dos objetos, el primero es el objeto "user", en el cual deberemos especificar que campos de este deseamos actualizar. Los posibles campos son: "name", "username","email" y "password". El segundo objeto es un "player", con el que podremos actualizar el campo "description". - 200 OK (User was succesfully updated)
- 404 NOT_FOUND (The user wasnt updated)
- https://localhost:8443/api/user/{id}/image
- POST
- El formato del body debe de ser "form-data", se debe crear una key llamada image, especificando que se trata de un "file" y en value sleccionar la imagen que se desea utilizar.
- 201 CREATED
- 409 CONFLICT (Image couldn't be uploaded)
- https://localhost:8443/api/user/{id}/image
- GET
- Vacío
- La imagen del usuario.
- 404 NOT_FOUND (Image not found)
- https://localhost:8443/api/tournaments
- GET
- Vacío
-
[ { "idTournament": 1, "numTeams": 8, "name": "Best Tournament", "description": "Here play the best", "img": null, "latitude": 13.0, "longitude": 2.0 }, { "idTournament": 2, "numTeams": 4, "name": "Tournament 2", "description": "The Second", "img": null, "latitude": 0.0, "longitude": 0.0 }, ...
- https://localhost:8443/api/tournaments/{id}
- GET
- Vacío
-
{ "idTournament": 1, "numTeams": 8, "name": "Best Tournament", "description": "Here play the best", "img": null, "latitude": 13.0, "longitude": 2.0 } ...
- https://localhost:8443/api/tournaments
- POST
-
{ "numTeams": 16, "name": "DEMO", "description": "Demostration tournament", "img": null, "latitude": 5, "longitude": 5 } - 201 CREATED (Tournament was succesfully created)
- 409 CONFLICT (Tournament wasnt created)
- https://localhost:8443/api/tournaments/{id}/teams
- POST
-
{ "name": "The flyers" } - 200 OK (Your team joined the tournament)
- 500 INTERNAL_SERVER_ERROR (Error)
- https://localhost:8443/api/tournaments/{idTournament}/matches
- GET
- Vacío
-
[ { "team_Id_Team": 14, "game_Id_Game": 9, "result": 0, "winner": false, "round": "1", "date": "Sun Mar 08 19:36:47 CET 2020", "teamIdTeam": 14, "gameIdGame": 9 } ... - 404 NOT_FOUND
- https://localhost:8443/api/tournaments/{idTournament}/games
- GET
- Vacío
-
[ { "id_game": 1, "tournament": { "idTournament": 1, "numTeams": 8, "name": "Best Tournament", "description": "Here play the best", "img": null, "latitude": 13.0, "longitude": 2.0 } }, ... - 404 NOT_FOUND
- https://localhost:8443/api/tournaments/{id}/image
- POST
-
El formato del body debe de ser "form-data", se debe crear una key llamada image, especificando que se trata de un "file" y en value sleccionar la imagen que se desea utilizar. - 201 CREATED
- 409 CONFLICT (Image couldn't be uploaded)
- https://localhost:8443/api/tournaments/{id}/image
- GET
- Vacío
- La imagen del torneo
- 404 NOT_FOUND (Image not found)
- https://localhost:8443/api/teamsOnGame/{id1}+{id2}+{idGame} Donde "id1" es el id del equipo 1, "id2" es el id del equipo 2 y "idGame" es el id del partido donde están esos equipos asociados.
- PUT
-
[ { "result": 2, "winner": false }, { "result": 5, "winner": true }
] Este body se compone de un aray de dos posiciones. La primera posición hace referencia al primer equipo y la segunda posición al segundo equipo. "Result" indica la puntuación de cada equipo.
- 200 OK (Teams results were succesfully updated)
- 404 NOT_FOUND (The team results werent updated)
Esta petición es utilizada para la funcionalidad "load more" de la página web.
- https://localhost:8443/api/leaderBoardLoaded
- GET
- Vacío
- Listado de los equipos que deben de aparecer de manera dinámica en la página web
- https://localhost:8443/api/teams/page={pageNum}
- GET
- Vacío
- Listado de equipos de 5 elementos por página
- 404 NOT_FOUND
- https://localhost:8443/api/teams
- POST
-
{ "name": "DEMO Team" } - 201 CREATED (Team was succesfully created)
- 409 CONFLICT (Team wasnt created)
- https://localhost:8443/api/teams/{id}
- PUT
-
{ "name": "The JS Scripters" } - 200 OK (Team was succesfully updated)
- 404 NOT_FOUND (The team wasnt updated)
- https://localhost:8443/api/teams/{name}
- GET
- Vacío
-
{ "name": "The flyers", "elo": 391, "wins": 22, "losses": 7, "id": 1 } - 404 NOT_FOUND (The team wasent found)
- https://localhost:8443/api/player/{idPlayer}/team
- PUT
-
{ "name": "DEMO Team" } - 200 OK (Team was succesfully updated)
- 404 NOT_FOUND (Player or team not found)
- https://localhost:8443/api/player/{idUser}
- GET
- Vacío
-
{ "idPlayer": 1, "user": { "iduser": 2, "name": "WillyRex", "username": "Willy", "email": "willy@gmail.com", "img": null, "rol": { "idRol": 2, "rolDes": "USER" } }, "description": "Im a casual player", "team": { "name": "los ps", "elo": 986, "wins": 1, "losses": 1, "id": 14 } } - 404 NOT_FOUND (Player not found)