restapirestful-architectureapi-design

Searching versus Filtering in Restful API


I have started reading some references about API design (Amazon, Microsoft, Github, Apigee..) and I encountered this sentence:

"A better API must implement search and filter functionality." (something like that ..)

I did not figure out:

What's the difference between Filtering and Searching in Restful context?

Cordially


Solution

  • Searching is all about the query that is being passed by the API consumer. Something like passing a ?q=rafael on a user context to find all users matching that name. Filtering, on the other hand, is about narrowing down those results based on other attributes from the resource. Something like ?q=rafael&age=23.