educative.io

Why are verbs preesnt in URI?

In general, URIs should be named with nouns that specify the contents of the resource, rather than adding a verb for the function being performed

So why is verb used in for eg, GET /v1.0/search?query={string}
while specifying API for search system
From the course: Grokking the API design interview

Hi Richa,

Search API will serve as a building block for the advanced API design problems. Using verbs such as “search” as an endpoint is a generic depiction of a search service. In advanced design chapters, it’ll be updated to use case specific such as “searchProducts,” “searchVideos,” etc.

Moreover, we can have this exception for some endpoints as well-known services do the same, such as YouTube’s search API.

Hope this clears the confusion, and we wish you happy learning at Educative!

Thank you,