title: Calling a WebAPI controller action that has 2 parameters
body: <p>I have a WebAPI controller action that has 2 parameters.
  How do i call this action?</p>
  
  <p>With a single parameter, my code works good.
  How do i call a WebAPI that has 2 parameters?
  I tried couple of ways and it does not work.
  I have a WebAPI controller action that has 2 parameters.
  How do i call this action?</p>
  
  <p>With a single parameter, my code works good.
  How do i call a WebAPI that has 2 parameters?
  I tried couple of ways and it does not work.</p>
  
  <p>Thanks in Advance</p>
  
  <pre><code>//With a single parameter it works good:
  [Route("api/Controller/GetAllVendors")]
  [HttpPost]
  public IEnumerable&lt;Vendor&gt; GetAllVendors(LoginParameters loginParam)
  {
  }
  
  function LoadVendorLkup() {
      alert("InVendorCall");
      var loginPar = {
      UserName: 'user1',
      CompanyID: 'company1',
      ProgramID: ''
  }
  $.ajax({
      type: 'POST',
      url: '/api/Controller/GetAllVendors',
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      data: JSON.stringify(loginPar), 
  
  /////////////////////////////////////////////////////////////////////////
  //With 2 parameters , it does not work:
  
  [Route("api/Controller/GetVendorsForSelectedHouseholdID")]
  [HttpPost]
  public IEnumerable&lt;Vendor&gt; GetVendorsForSelectedHouseholdID(LoginParameters loginParam, string hHoldID)
  {
  }
  
  function LoadVendorLkupForSelectedHousehold() {
      var hHoldtext = $('#txtHHold').val();
      var loginPar = {
      UserName: 'user1',
      CompanyID: 'company1',
      ProgramID: ''
  }
   $.ajax({
      type: 'POST',
      url: '/api/controller/GetVendorsForSelectedHouseholdID',
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      data: JSON.stringify(loginPar), 'hHoldID': hHoldtext,
  //////////////////////////////////////////////////////
  
  //I also tried the following:
  [Route("api/controller/GetVendorsForSelectedHouseholdID/{hHoldID:String}")]
  [HttpPost]
  public IEnumerable&lt;Vendor&gt; GetVendorsForSelectedHouseholdID([FromBody()]LoginParameters loginParam,[FromUri()]string hHoldID)
  {
  }
  
  function LoadVendorLkupForSelectedHousehold() {
      alert("InVendorCall2");
      var hHoldtext = $('#txtHHold').val();
      alert("Household:" + hHoldtext);
      var loginPar = {
      UserName: 'user1',
      CompanyID: 'company1',
      ProgramID: ''
  }
  $.ajax({
      type: 'POST',
      url: '/api/controller/GetVendorsForSelectedHouseholdID?hHoldID='+ hHoldtext,
      dataType: "json",
      contentType: "application/json; charset=utf-8",
      data: JSON.stringify(loginPar), 
  </code></pre>