Here is my ajax call which is calling GetFileContents:
views.titleClick = function (e) {
var grid = $("#documentsGrid").data("kendoGrid");
var docId = grid._data[0].DocumentId;
$.ajax({
type: "GET",
//"Document/GetByReview?reviewId=" + that.selectedReview.ReviewId;
url: constants.serviceUrl + "Document/GetFileContents?DocumentId=" + docId,
contentType: "application/json; charset=utf8",
})
};
Below is my Controller GetFileContents
[HttpGet]
public HttpResponseMessage GetFileContents(int id)
{
DataResponseSingle<Document> result = BusinessAccess.GetById(id);
if (result.ResponseType != ResponseType.Success)
{
return CreateHttpResponse(result);
}
if (result.Data == null || result.Data.DocumentData == null)
{
return CreateHttpResponse(ResponseType.NotFound);
}
return CreateStreamContentHttpResponse(result.Data.DocumentData, "application/octet-stream", result.Data.Name);
}
Whenever titleClick gets instantiated I get an error saying
"{"Message":"No HTTP resource was found that matches the request URI 'http://localhost/Services/HumanResources/api/Document/GetFileContents?DocumentId=4'.","MessageDetail":"No action was found on the controller 'Document' that matches the request."}"
. I have other controllers in this Service file which I am able to call perfectly fine. I am guessing something wrong with my syntax ? Please help , I looked around here but could not find something specific to my problem. Thanks!