I’m making an API in asp mvc 4.
I have 2 methods, GetAllBooks() and GetPopularBooks().
To get all books, I call localhost:xxxxx/api/books/, and I get the correct result.
How can I query the popular books? Both methods are parameterless and our info here is not really helpful.
All help is appreciated!
Although this could be achieved using “Routing by Action Name” http://www.asp.net/web-api/overview/web-api-routing-and-actions/routing-in-aspnet-web-api. I strongly suggest that GetPopularBooks() be treated as GetAllBooks but with a filter of popularity.
e.g.
Urls: