I am using asp.net web api.I am using MVC with that. I am trying to call below ajax call but it alway give me 404 error.
It I try without three parameters "Hash", "AccessKey","Path" - then it allows me to call method of http://www.xxx.xys/rest/createnew and gives response good as I wish.
but when I add these three("Hash", "AccessKey","Path" ) parameters it always gives me error not found(404) error.
here no error due to cross domain as becuase it is running good wihtout three parameters. I want to pass three parameters as argument not as properties of object CreateParameter.not in header requset. only I want to pass them in parameters.
function CreateTicket() {
$.ajax({
url: 'http://www.xxx.xys/rest/createnew',
type: 'POST',
dataType: 'json',
data: {
MerchantID: $("#txtMerchantID").val(), TicketCategoryID: $("#txtTicketCategoryID").val(), GroupID: $("#txtGroupID").val(), TicketSubCategoryID: $("#txtSubCategoryID").val(), TicketPriorityID: $("#txtTicketPriorityID").val(), Summary: '' + $("#txtSubject").val() + '',
Hash: "EI2nkSoqRN5cBO/ctXF90tl+c0UTW/euI8NZwsG8ZBE=", AccessKey: "d357cf6e-bb14-452e-8044-68c699503c2b", Path: "api/TicketAPIs/GetTicketsByFilter"
},
crossDomain: true,
ContentType: "application/json; charset=utf-8",
success: function (data) {
if (data.IsSuccess) {
alert('created');
}
else {
alert('error');
}
},
error: function (data) {
alert('error');
}
});
}
and
[HttpPost]
public CreateTicketResult createnew([FromBody]CreateParameter ObjParameter,string Hash, string AccessKey, string Path)
{
//code here
}
and I have also tried with below but not working.
[HttpPost]
public CreateTicketResult createnew(CreateParameter ObjParameter,string Hash, string AccessKey, string Path)
{
//code here
}
public class CreateParameter
{
public int MerchantID { get; set; }
public short TicketCategoryID { get; set; }
public short GroupID { get; set; }
public short TicketSubCategoryID { get; set; }
public short TicketPriorityID { get; set; }
public string Summary { get; set; }
}
so I want to pass MerchantID,TicketCategoryID,GroupID,TicketSubCategoryID,TicketPriorityID, Summary as property of object of CreateParameter and these three("Hash", "AccessKey","Path" ) as seperate parameters as shown in signature of function createnew. but could not able to do so.