Ajay Kumar

Ajay Kumar

  • 54
  • 29.1k
  • 1.6m

Rest Api Issue in c#

Feb 24 2024 11:03 AM

in Asp.net MVC Rest Api I Have Passed The Add Parameter but in Response It Said that the parameter is missing

There is an API That works properly in Postman But When I Execute the same API in the Asp.net MVC Project it gives me a missing parameter. Below is the Rest of the API Code. 

 

System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
string Baseurl = "End Point URL";
var client = new RestClient(Baseurl + "billpay/customer-params");
var request = new RestRequest(Method.POST);
request.AddHeader("X-Root-id", agentid);
request.AddHeader("Authorization", "Bearer " + token + "");
request.AddHeader("clientId", clientId);
request.AddHeader("ClientSecret", ClientSecret);
request.AddHeader("distributorCode", distributorCode);
request.AddHeader("content-type", "application/json");
request.AlwaysMultipartFormData = true;
request.AddParameter("agent", agentid);
request.AddParameter("billerid", billerid);
IRestResponse responsecheck = client.Execute(request);
return responsecheck;


Answers (2)