It is a demonstrative REST API application for task management developed using Spring Boot with H2 database and OAuth2 to authentication.
The project is published on the HEROKU platform integrated with GitHub.
https://itau-task-control.herokuapp.com/swagger-ui.html
- It is not necessary to make any changes to the application.properties
- The data.sql file contains the data of users previously registered when starting the application.
-
Install Java JDK 1.8 and set it as an environment variable.
-
Install Maven and set it as an environment variable.
-
Build the project with the following commands.
mvn clean install
mvn package
-
Execute the project.
java -jar target/itau-task-control-0.0.1.jar
-
Access the Swgger UI.
-
Authenticate (OAuth2) the user using the example postman or curl command.
curl --location --request POST 'https://localhost:8080/oauth/token' --header 'Authorization: Basic aXRhdS10YXNrOml0YXUtdGFzay1zZWNyZXQ=' --form 'username=juliana' --form 'password=juli2020' --form 'grant_type=password'
- It is also possible to use API through the swagger page.
- In the swagger, fill in the Authorization field the following "Bearer [ACCESS_TOKEN]"
-
Register task.
curl -X POST "https://localhost:8080/tasks" -H "accept: /" -H "Authorization: Bearer l+2nilfBzQOudwMWJ6wuTRNWHKE=" -H "Content-Type: application/json" -d "{"description": "teste 222", "status": "PENDING", "summary": "teste 222"}"
-
Search all tasks.
curl -X GET "https://localhost:8080/tasks" -H "accept: /" -H "Authorization: Bearer l+2nilfBzQOudwMWJ6wuTRNWHKE="
-
Update a task.
curl -X PUT "https://localhost:8080/tasks" -H "accept: /" -H "Authorization: Bearer bnayOvEPJIrDDgGI8Xxizf6mUsw=" -H "Content-Type: application/json" -d "{ "id": 2, "summary": "teste alterada", "description": "teste desc alterada", "status": "COMPLETED" }"
-
Search task by status.
curl -X GET "https://localhost:8080/tasks/status/PENDING" -H "accept: /" -H "Authorization: Bearer +W7oZ3o7mZAFLlabMCb2mRyecx4="
-
Delete task by ID.
curl -X DELETE "https://localhost:8080/tasks/1" -H "accept: /" -H "Authorization: Bearer +W7oZ3o7mZAFLlabMCb2mRyecx4="
curl -X GET "https://localhost:8080/actuator/health" -H "accept: /" -H "Authorization: Bearer X/JptYEx1/y6gZGHYDbc2M6hDAA="
curl -X GET "https://localhost:8080/actuator/httptrace" -H "accept: /" -H "Authorization: Bearer X/JptYEx1/y6gZGHYDbc2M6hDAA="
-
Search all available metrics
curl -X GET "https://localhost:8080/actuator/metrics" -H "accept: /" -H "Authorization: Bearer X/JptYEx1/y6gZGHYDbc2M6hDAA="
-
Example of metrics to http requests
curl -X GET "https://localhost:8080/actuator/metrics/http.server.requests" -H "accept: /" -H "Authorization: Bearer X/JptYEx1/y6gZGHYDbc2M6hDAA="
- Execute
mvn test
- Reports
cd target/surefire-reports/
-
Execute
mvn javadoc:javadoc
-
Reports
cd target/site/apidocs
Open index.html