Get requests not exposed with ASP.NET web API
I have a web API controller named FriendsManagementController
But when I run the site in debug mode and go to the autocreated help page
for API the 2 GET methods are not accessable
And I cant access them through JSON request I fire from my WindowsPhone
emulator (Other requests on the site runs just fine)
So why are these 2 Get requests not exposed?
public class FriendsManagementController : ExtendedApiController
{
private readonly IFriendAdapter _friendAdapter;
public FriendsManagementController(IHttpDecoder httpDecoder, ILoginHandler
loginHandler,
IFriendAdapter friendAdapter) :
base(httpDecoder, loginHandler)
{
_friendAdapter = friendAdapter;
}
public void Get()
{
}
public HttpResponseMessage Get([FromBody] string searchString)
{
List<string> searchResult = _friendAdapter.SearchFriends(searchString);
return Request.CreateResponse(HttpStatusCode.Accepted, searchResult);
}
public void Post()
{
}
// PUT api/friendsmanagement/5
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/friendsmanagement/5
public void Delete(int id)
{
}
ExtendedAPIController simply implements some authentication
public class ExtendedApiController : ApiController
{
public ExtendedApiController(IHttpDecoder httpDecoder, ILoginHandler
loginHandler)
{
HttpDecoder = httpDecoder;
LoginHandler = loginHandler;
}
....
}
No comments:
Post a Comment