Manage your favorite hockey team!
admin@icehockeymanager.com
with password test
It is needed to authenticate yourself before any requests which changes data on the server (except basic registration).
To register martin@m.com with password 123456
curl -X POST -H 'Content-Type: application/json' -d '{
"username":"martin",
"email":"martin@m.com",
"role":"USER",
"password":"123456"}' http://localhost:8080/pa165/rest/register
Get your client id and client secret:
rest-client
58aa46b5-ddb1-4a29-bed9-55b9f3521280
Generate Authorization header
Authorization: Basic cmVzdC1jbGllbnQ6NThhYTQ2YjUtZGRiMS00YTI5LWJlZDktNTViOWYzNTIxMjgw
Authenticate yourself as martin@m.com with password 123456
curl -X POST -H "Authorization: Basic cmVzdC1jbGllbnQ6NThhYTQ2YjUtZGRiMS00YTI5LWJlZDktNTViOWYzNTIxMjgw" "http://localhost:8080/pa165/rest/oauth/token?grant_type=password&username=martin@m.com&password=123456"
Get a response
You will get access token valid for 10 minutes
{
"access_token": "e1aaa981-9384-4761-b2ae-f21a316794a5",
"token_type": "bearer",
"refresh_token": "d40db753-2b3f-4822-bfbc-509d11a32638",
"expires_in": 600,
"scope": "read write trust",
"role": "USER",
"userId": 13
}
Setup header before api request
Setup authorization header before any request to the API:
"Authorization: Bearer e1aaa981-9384-4761-b2ae-f21a316794a5"
Then change password in postman like:
method: POST
url: http://localhost:8080/pa165/rest/managers/changepassword?id=1&oldPass=test&newPass=pass
Headers: Authorization Bearer e1aaa981-9384-4761-b2ae-f21a316794a5
Refresh expired token
Please follows these steps if you run prod build after fetching the most recent changes from master:
1) mvn clean install
2) cd ice-hockey-manager-web
3) npm install
4) npm run build
5) cd ..
6) mvn install
7) cd ice-hockey-manager-web
8) mvn tomcat7:run
http:/localhost:8080/pa165/rest
http:/localhost:8080/pa165
Later, when you made some changes only in web module and wanna check it out at prod, just run:
1) cd ice-hockey-manager-web
2) mvn clean
3) npm install
4) npm run build
5) mvn install
6) mvn tomcat7:run
This saves some time for you since only web module is cleaned and installed.
mvn clean install && cd ice-hockey-manager-web && mvn tomcat7:run
In another terminal:
cd ice-hockey-manager-web && npm run start
http:/localhost:8080/pa165/rest
http:/localhost:3000/pa165
URL: http:/localhost:8080/pa165/rest/teams/create
method: PUT
data format: { "name":"HC Sparta test d Praha", "competitionCountry":"CZECH_REPUBLIC", "humanPlayerId":null, "budget":7000.00 }
URL: http:/localhost:8080/pa165/rest/teams/all
method: GET
URL: http:/localhost:8080/pa165/rest/teams/{id}
method: GET
URL: http:/localhost:8080/pa165/rest/teams/getByName/{name}
method: GET
URL: http:/localhost:8080/pa165/rest/teams/{id}
method: DELETE
URL: http:/localhost:8080/pa165/rest/teams/getByCompetitionCountry/{competitionCountry}
method: GET
URL: http:/localhost:8080/pa165/rest/teams/spendMoneyFromBudget
method: POST
data format: { "teamId": 1, "amount": 20 }
URL: http:/localhost:8080/pa165/rest/teams/{id}/price
method: GET
URL: http:/localhost:8080/pa165/rest/teams/{id}/attack
method: GET
URL: http:/localhost:8080/pa165/rest/teams/{id}/defense
method: GET
URL: http:/localhost:8080/pa165/rest/teams/addHockeyPlayer
method: POST
data format: { "teamId": 1, "hockeyPlayerId": 1 }
URL: http:/localhost:8080/pa165/rest/teams/removeHockeyPlayer
method: POST
data format: { "teamId": 1, "hockeyPlayerId": 1 }
URL: http:/localhost:8080/pa165/rest/players/create
method: PUT
data format: { "name":"Jaromir Jagr", "post":"RIGHT_WING", "attSkill":99, "defSkill":15, "price":100.00 }
URL: http:/localhost:8080/pa165/rest/players/all
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-by-team/{teamId}
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-free-agents
method: GET
URL: http:/localhost:8080/pa165/rest/players/{id}
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-by-name/{name}
method: GET
URL: http:/localhost:8080/pa165/rest/players/{id}
method: DELETE
URL: http:/localhost:8080/pa165/rest/players/get-by-post/{post}
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-by-att-skill/{attSkill}
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-by-deff-skill/{defSkill}
method: GET
URL: http:/localhost:8080/pa165/rest/players/get-by-price/{price}
method: GET
http://localhost:8080/pa165/rest/managers/all
method: GET
URL: http:/localhost:8080/pa165/rest/managers/{id}
method: GET
URL: http:/localhost:8080/pa165/rest/managers/byemail?email=email
method: GET
URL: http:/localhost:8080/pa165/rest/managers/byusername?username=username
method: GET
URL: http:/localhost:8080/pa165/rest/games/create
method: POST
data format: { "firstTeamId":1, "secondTeamId":2, "startTime":"2030-01-01T18:00:00" }
URL: http:/localhost:8080/pa165/rest/games/{id}
method: DELETE
URL: http:/localhost:8080/pa165/rest/games/cancel/{id}
method: PUT
URL: http:/localhost:8080/pa165/rest/games/retrieve/{id}
method: PUT
URL: http:/localhost:8080/pa165/rest/games/{id}
method: PUT
data format: { "id": null, "startTime":"2030-01-01T18:00:00" }
URL: http:/localhost:8080/pa165/rest/games/{id}
method: GET
URL: http:/localhost:8080/pa165/rest/games/byteam?teamId={id}
method: GET
URL: http:/localhost:8080/pa165/rest/games/all
method: GET
URL: http:/localhost:8080/pa165/rest/games/scheduled
method: GET
URL: http:/localhost:8080/pa165/rest/games/play
method: PUT