/api/v1/students/{id}
// Response Code: 200 OK
/api/v1/students/
// Response Code: 200 OK
/api/v1/students/search?lastName={lastName}
// Example, Query Parameter
/api/v1/students/search?lastName=Persson
// Response Code: 200 OK
/api/v1/students
// Body
{
"firstName" : "Sara",
"lastName" : "Persson",
"email" : "sarap@email.com",
"phoneNumber" : "073548824"
}
// Response Code: 201 Created
// Header - Location: .../student-management-system/api/v1/students/1
/api/v1/students/{id}
// Body
{
"firstName" : "Sara",
"lastName" : "Andersson",
"email" : "saraandersson@email.com",
"phoneNumber" : "073548824"
}
// Response Code: 200 OK / 201 Created
// 201 Created:
// Header - Location: .../student-management-system/api/v1/students/1
/api/v1/students/{id}
// Body
{
"email" : "andersson@email.com"
}
// Response Code: 200 OK
/api/v1/students/{id}
// Response Code: 204 No content
@Size(min = 2, message = "Min. 2 characters")
@NotEmpty(message = "Must not be empty")
private String firstName;
@Size(min = 2, message = "Min. 2 characters")
@NotEmpty(message = "Must not be empty")
private String lastName;
@Email(regexp = ".+@.+\\..+", message = "Not a valid email adress.")
@NotEmpty(message = "Must not be empty")
private String email;
// Response Code: 404 Not Found
{
"error message": "Student not found.",
"student id": 99
}
- ConstraintViolationException
// Response Code: 400 Bad Request
[
{
"error message": "Must not be empty",
"property": "firstName"
},
{
"error message": "Not a valid email adress.",
"property": "email"
},
{
"error message": "Must be between 2 - 50 characters",
"property": "lastName"
},
{
"error message": "Must be between 2 - 50 characters",
"property": "firstName"
}
]