I have a Backbone.js application and it's calling one of my WEB API custom POST method. Here is the code to my Custom POST
WebApiConfig.cs
config.Routes.MapHttpRoute
(
name: "UserAdministrationApi",
routeTemplate: "api/{controller}/PostUserInfo/{EmployeeDTO}",
defaults: new
{
EmployeeDTO = RouteParameter.Optional,
controller = "UserAdministration",
action = "PostUserInfo",
});
Controller
[HttpPost]
[ActionName("PostUserInfo")]
public HttpResponseMessage PostUserInfo(EmployeeDTO value)
{
// handling POST
}
EmployeeDTO
public class EmployeeDTO
{
public bool masAccess { get; set; }
public bool reportAccess { get; set; }
public string name { get; set; }
public string office { get; set; }
}
When I try to test this in Fiddler even before going to test it with Backbone.js code, I am getting 500 Internal error. Not sure what's wrong
// FIDDLER TEST
POST : http://localhost:56501/api/useradministration/PostUserInfo
Request Body
{
masAccess:"true"
reportAccess:"false"
}
Thank you for the help
PostUserInfo
might be relevant. – Andrei Jun 5 at 17:18masAccess=true&reportAccess=false
. – Andrei Jun 5 at 17:27