Service project for data requirements
todo project contains rest services for creating, updating, deleting and saving todos
Running project from Eclipse
- Run eclipse
- Select "Import/Existing Maven Project" from File menu
- Select "services" project
- Right click on Application.java and choose "Run As/Java Application"
- After a while, Spring project will start
- You can make request through the url: http://localhost:8080/todos
Running project from Command Line
Alternatively, you can run the war file provided from the command line: java -jar todos.jar
Provided Rest services
Getting all todos
- URL: http://localhost:8080/todos
- Method: GET
- Path Variable: NA
- Request Body: NA
- Response Body: Todo list
Getting a specific todo
- URL: http://localhost:8080/todos/{id}
- Method: GET
- Path Variable: id of todo to be read
- Request Body: NA
- Response Body: Todo
Deleting a todo
- URL: http://localhost:8080/todos/{id}
- Method: DELETE
- Path Variable: id of todo to be deleted
- Request Body: NA
- Response Body: deleted todo
Updating a todo
- URL: http://localhost:8080/todos/{id}
- Method: PUT
- Path Variable: id of todo to be updated
- Request Body: todo data
- Response Body: updated todo
Saving a todo
- URL: http://localhost:8080/todo
- Method: POST
- Path Variable: NA
- Request Body: todo data
- Response Body: saved todo. The id value will be assigned randomly.
Exceptional Cases
To test exceptional cases, simply send a request as follows: http://localhost:8080/todo?code=111
In this case, the server will return an error code of 500 when request contains a parameter named "code"