{"info":{"_postman_id":"511a4c1f-ffa9-4c6f-82a2-bbc0fbc4faa7","name":"proyectoITR","description":"<html><head></head><body><p>Complete documentation of the REST API developed for the postulation in ITR - Semillero del Mundo. It handles a system to manage a list of football players to prepare a team.</p>\n</body></html>","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"owner":"24423357","collectionId":"511a4c1f-ffa9-4c6f-82a2-bbc0fbc4faa7","publishedId":"2s8YzS1imC","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"EF5B25"},"publishDate":"2022-12-12T00:36:41.000Z"},"item":[{"name":"Players","item":[{"name":"addPlayer","id":"e17ce69c-3df3-4f7f-8b20-a2cd6376fcd0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"Lautaro \",\r\n    \"lastName\": \"Martinez \",\r\n    \"age\": 25,\r\n    \"team\": \"Inter\",\r\n    \"position\": [\r\n            \"DELANTERO\", \"ARQUERO\"\r\n        ],\r\n    \"number\": 165\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:8080/players","description":"<p>All atributes that are not specified, will be null.</p>\n<p>\"numero\" is automatically set when Lista becomes DEFINITIVA.</p>\n","urlObject":{"port":"8080","path":["players"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e17ce69c-3df3-4f7f-8b20-a2cd6376fcd0"},{"name":"findPlayerById","id":"08d319ad-11a7-4249-be13-432257b5c035","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:8080/players/500","description":"<p><code>localhost:8080/players/6</code></p>\n<p>The number 6 should be changed to the desired id.</p>\n<p>If the player is not found, it returns STATUS 404 NOT FOUND.</p>\n","urlObject":{"port":"8080","path":["players","500"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"08d319ad-11a7-4249-be13-432257b5c035"},{"name":"updatePlayerById","id":"ae827eb5-7826-4c33-9355-84ad8852dd1d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"body":{"mode":"raw","raw":"{\r\n    \"name\": \"Dibu \",\r\n    \"lastName\": \"Martinez \",\r\n    \"age\": 30,\r\n    \"team\": \"Aston RB\",\r\n    \"number\": 20,\r\n    \"position\": [\r\n        \"ARQUERO\"\r\n    ]\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:8080/players/500","description":"<p>Can recieve one or more parameters. Those not included will not be changed. The id will not be changed.</p>\n<p>If the player is not found, it returns STATUS 404 NOT FOUND.</p>\n","urlObject":{"port":"8080","path":["players","500"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"ae827eb5-7826-4c33-9355-84ad8852dd1d"},{"name":"listPlayer","id":"b0632a02-1440-4e6a-aa3d-560904c830c0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:8080/players","description":"<p>Gets the complete list of jugadores.</p>\n","urlObject":{"port":"8080","path":["players"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b0632a02-1440-4e6a-aa3d-560904c830c0"},{"name":"deletePlayerById","id":"54253032-5135-49f2-b9bb-01cd7322623a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"localhost:8080/players/453","description":"<p><code>localhost:8080/players/1</code></p>\n<p>The number 1 should be changed by the id of the player to be deleted.</p>\n<p>If the player is not found, it returns STATUS 404 NOT FOUND.</p>\n","urlObject":{"port":"8080","path":["players","453"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"54253032-5135-49f2-b9bb-01cd7322623a"},{"name":"deleteAllPlayers","id":"2e3ce33c-eab8-44d0-8eaa-79d26fa49adf","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"localhost:8080/players/deleteAllPlayers","description":"<p>Clears the table of players.</p>\n","urlObject":{"port":"8080","path":["players","deleteAllPlayers"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"2e3ce33c-eab8-44d0-8eaa-79d26fa49adf"}],"id":"65261aed-b2fa-4f4f-8ecf-e0e26ed6c8a4","description":"<p>All the endpoints related with the players management.</p>\n","_postman_id":"65261aed-b2fa-4f4f-8ecf-e0e26ed6c8a4"},{"name":"Rosters","item":[{"name":"addPlayerToRoster","id":"c83082d1-5270-40c1-a2f9-8215cd977ad7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"url":"localhost:8080/rosters/addPlayer/1?idPlayer=427","description":"<p>StartFragment</p>\n<p>If the roster is FINAL it will not add the player and instead return an error message and a STATUS 400 BAD REQUEST</p>\n","urlObject":{"port":"8080","path":["rosters","addPlayer","1"],"host":["localhost"],"query":[{"key":"idPlayer","value":"427"}],"variable":[]}},"response":[],"_postman_id":"c83082d1-5270-40c1-a2f9-8215cd977ad7"},{"name":"addRoster","id":"507139c9-c4ba-487b-9130-dda14dba08bc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[],"body":{"mode":"raw","raw":"{\r\n    \"jugadores\": [],\r\n    \"nombre\": \"unica lista existente\"\r\n}","options":{"raw":{"language":"json"}}},"url":"localhost:8080/rosters","description":"<p>None of the atributes are mandatory. \"state\" initializes automatically as ENPROCESO and \"players\" as empty.</p>\n<p>Only one roster is accepted. If there already exists one, using this method will return a status 500 INTERNAL SERVER ERROR</p>\n<p>If you want more than one list to be able to exist, remove this validation in the class com/appMundial/lista2026/service/roster/impl/RosterServiceImpl.java:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-java\">@Override\n    public Roster addRoster(RosterDto rosterDto) throws RosterAlreadyExistsException {\n        Roster rosterEntity = paseRosterDtoToEntity(rosterDto);\n\n        // DELETE THIS VALIDATION TO ALLOW MORE THAN ONE ROSTER TO BE CREATED v\n        if (rosterRepository.findAll().size() &gt; 0) {\n            RosterAlreadyExistsException e = new RosterAlreadyExistsException(rosterAlreadyExists);\n            throw e;\n        }\n        // DELETE THIS VALIDATION TO ALLOW MORE THAN ONE ROSTER TO BE CREATED ^\n\n        rosterEntity.setState(ENPROCESO);\n\n        LOGGER.info(newRosterAdded);\n        return rosterRepository.save(rosterEntity);\n\n    }\n\n</code></pre>\n","urlObject":{"port":"8080","path":["rosters"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"507139c9-c4ba-487b-9130-dda14dba08bc"},{"name":"listRoster","id":"fb375161-7ba8-4b36-bfd3-6e3bc1cc0d91","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:8080/rosters","urlObject":{"port":"8080","path":["rosters"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"fb375161-7ba8-4b36-bfd3-6e3bc1cc0d91"},{"name":"makeRosterFINAL","id":"e448bd7a-64a3-4f3c-8e20-b315d3df2efa","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"localhost:8080/rosters/makeRosterDEFINITIVA/1","description":"<p>It checks if the list has all the conditions to be FINAL.</p>\n<p>If the roster does not have exactly 23 players or if there are less than 2 players of any of the positions, it will return an error message and a STATUS 400 BAD REQUEST</p>\n","urlObject":{"port":"8080","path":["rosters","makeRosterDEFINITIVA","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"e448bd7a-64a3-4f3c-8e20-b315d3df2efa"},{"name":"getRosterById","id":"b54bfb19-53bf-4fc2-87b9-72257659ff80","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:8080/rosters/1","urlObject":{"port":"8080","path":["rosters","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"b54bfb19-53bf-4fc2-87b9-72257659ff80"},{"name":"countPlayersInRoster","id":"ca36bb45-2c8d-4f14-b78e-7c7e27e032df","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"localhost:8080/rosters/amountOfPlayersInRoster/1","description":"<p>Returns a long with the ammount of players in the list.</p>\n","urlObject":{"port":"8080","path":["rosters","amountOfPlayersInRoster","1"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"ca36bb45-2c8d-4f14-b78e-7c7e27e032df"},{"name":"makeRosterENPROCESO","id":"d3ec7b92-f234-44ec-ac05-559178a3beb4","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[],"url":"localhost:8080/rosters/makeRosterENPROCESO/3","urlObject":{"port":"8080","path":["rosters","makeRosterENPROCESO","3"],"host":["localhost"],"query":[],"variable":[]}},"response":[],"_postman_id":"d3ec7b92-f234-44ec-ac05-559178a3beb4"},{"name":"removePlayerFromRoster","id":"43016888-66bb-44a8-b6ab-1653417b1c03","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[],"url":"localhost:8080/rosters/removePlayer/1?idPlayer=426","description":"<p>If the roster is FINAL it will not delete the player and instead return an error message and a STATUS 400 BAD REQUEST</p>\n","urlObject":{"port":"8080","path":["rosters","removePlayer","1"],"host":["localhost"],"query":[{"key":"idPlayer","value":"426"}],"variable":[]}},"response":[],"_postman_id":"43016888-66bb-44a8-b6ab-1653417b1c03"}],"id":"e008f1dd-9e32-43f5-aabc-c7a28d21fbc8","description":"<p>StartFragment</p>\n<p>All the endpoints related with the lists management.</p>\n<p><strong>IMPORTAT</strong></p>\n<p>This API is developed to ONLY ACCEPT ONE LIST, but this can be changed. In order to allow more than one line, the method <code>addLista()</code> in the package <code>com.appMundial.lista2026.service.lista.impl.ListaServiceImpl</code> class by deleting the validation that prevents it:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-java\">    @Override\n    public Lista addLista(ListaDto listaDto) throws ListaDeJugadoresAlreadyExistsException {\n        Lista listaEntity = paseListaDtoToEntity(listaDto);\n\n        // DELETE THIS VALIDATION TO ALLOW MORE THAN ONE LISTA TO BE CREATED\n        if (listaRepository.findAll().size() &gt; 0) {\n            ListaDeJugadoresAlreadyExistsException e = new ListaDeJugadoresAlreadyExistsException(\"Ya hay una lista en la base de datos\");\n            throw e;\n        }\n\n        listaEntity.setEstado(Estado.ENPROCESO);\n\n        LOGGER.info(\"Se creó una nueva lista\");\n        return listaRepository.save(listaEntity);\n\n    }\n\n</code></pre>\n<p>EndFragment</p>\n","_postman_id":"e008f1dd-9e32-43f5-aabc-c7a28d21fbc8"}]}