Code for controller
[Authorize]
[HttpPut]
[Route("TopHandler/{studentId}")]
public async Task<HttpResponseMessage> CreateClass(string studentId, String projectId)
{
var response = await Task.Run(() =>
{
// Some Code here
});
return response;
}
Code for Controller call
await VML.Client.PutAsJsonAsync("TopHandler/" + studentId, projectId);
Unfortunately this end point cannot be found by the request and it gives 404 I am passing a string as a parameter . What would possibly go wrong here ?
My understanding is when you call PutAsJsonAsync the parameters are converted to JSON and sent in the BODY of the request.
At a guess you should change your signature to:
[Route("TopHandler/{studentId}")]
public async Task<HttpResponseMessage> CreateClass([FromBody]string JSON)