Tuesday, October 8, 2013

GET overloads in the ASP.NET web API

In conflict to what I say here, it looks like there is overloading for GET in this shape:

public string Get(int id)
{
   return "foo";
}
public string GetAll()
{
   return "bar";
}

 
 

These two methods could respectively be hit by these two urls:

  • /api/PET/42
  • /api/PET

 
 

GET stuff should be nullipotent (there is no change to state regardless of how may times one hits a GET method or if one does not hit the method at all).

No comments:

Post a Comment