Look at the handler method definition and choose the request that can be handled by it:
Java
@PostMapping(value = "/employees")
public String greet(@RequestBody List<Employee> employees)
Kotlin
@PostMapping(value = ["/employees"])
fun greet(@RequestBody employees: List<Employee>): String
Requests:
1
GET http://localhost:8080/employees
Content-Type: application/json
[
{
"id" : "290",
"firstName" : "Andrew",
"lastName" : "Scott",
"phone" : "570827"
},
{
"id" : "832",
"firstName" : "Sally",
"lastName" : "Johnson",
"phone" : "293818"
}
]
2
POST http://localhost:8080/employees
Content-Type: application/json
{
"id" : "290",
"firstName" : "Andrew",
"lastName" : "Scott",
"phone" : "570827"
}
3
POST http://localhost:8080/employees
Content-Type: application/xml
{
"id" : "290",
"firstName" : "Andrew",
"lastName" : "Scott",
"phone" : "570827"
}
4
POST http://localhost:8080/employees
Content-Type: application/json
[
{
"id" : "290",
"firstName" : "Andrew",
"lastName" : "Scott",
"phone" : "570827"
},
{
"id" : "832",
"firstName" : "Sally",
"lastName" : "Johnson",
"phone" : "293818"
}
]