Let's say I've got a REST endpoint which is returning a list of people from some location, which can be referenced by address.
GET /people?address=London
A response could be:
[{
"name":"Jane",
"age":72
},{
"name":"John",
"age": "23"
},
....
But let's say there are people from London UK, but there are also matches from other places (like London, Arkansas, US).
Is it OK, that for this case I return a completely different response?
[{
"address":"London, UK",
"count":31
},{
"address":"London, AK, US",
"age": "12"
}
....
Is this a good practice? Or maybe in the second case I should set a different status code?