Reputation: 335
I'm trying to implement pagination for a resource in webapi, but it ruined other action which return singleById resource.
So there are two functions for getting object/s in my api ( one single another mass but paged ) like below:
public HttpResponseMessage Get(int page,string type="mm");
public HttpResponseMessage Get(int id);
The type option is a semi search like optional filter.
I know it has conflicts i made it string id but it didn't work, i thought about a way routing each action separately or renaming them but it doesn't work cause the default route is like api/{controller}/{id}
and doesn't include action names beside i don't like to have api/{controller}/post/
to be generated.
Upvotes: 2
Views: 47
Reputation: 335
I decided to use Attribute Routing
[Route("specefiedController/{id}/single")]
to have getById
action and let the other actions be as they were
Upvotes: 2