I am developing a REST API and have an entity for "people":
GET http://localhost/api/people
Returns a list of all people in the system
GET http://localhost/api/people/1
Returns the person with identifier 1.
GET http://localhost/api/people?forename=john&surname=smith
It returns all people with matching first and last names, but I have one more requirement. What is the cleanest / best way to allow API users to retrieve all the people whose name begins with "jo", for example.
I have seen some APIs do this like:
GET http://localhost/api/people?forename=jo~&surname=smith
where tilde means "fuzzy" match. On the other hand, I saw that it is implemented with completely different criteria, for example.
GET http://localhost/api/people?forename-startswith=jo&surname=smith
which seems a bit cumbersome given that I might have a -response, -supported, -soundslike (for some soundex match).
- , , API REST, .