title: How to call web api multiple GET methods through AJAX
body: <p>I have added two GET methods into webapi as follow:</p>
  
  <pre><code>    public IList&lt;ProductDTO&gt; GetAllProducts()
      {
          ProductManager pm = new ProductManager();
  
          return pm.RetrieveAllProducts();
          //return pm.RetrieveAllProducts();
      }
  
      public ProductDTO GetProduct(int i)
      {
          ProductManager pm = new ProductManager();
  
          return pm.RetrieveAllProducts().Where(c =&gt; c.Id == i).FirstOrDefault();
          //return pm.RetrieveAllProducts();
      }
  </code></pre>
  
  <p>Problem, when i only kept one get method <code>GetAllProducts()</code> then it works fine. but when i added <code>GetProduct(int i)</code> then giving me error as <code>Not found 404</code> error.</p>
  
  <p>Please guide me how i could keep both the mthod and allow to access method having argument.</p>
  
  <p>calling as follow:</p>
  
  <pre><code>           $.ajax({
              type: 'GET',
              url: 'api/values/GetProduct/1',   //giving error as NOT FOUND
              contentType: 'json',
              dataType: 'json',
              success: function (data) {
                  $.each(data, function (key, value) {
                      //stringify
                      alert(key);
                      alert(value);
                      var jsonData = JSON.stringify(value);
  
                      //Parse JSON
                      var objData = $.parseJSON(jsonData);
                      var id = objData.Id;
                      var Cost = objData.Cost;
                      var ProductName = objData.ProductName;
                      var Description = objData.Description;
                      $('&lt;tr&gt;&lt;td&gt;' + id + '&lt;/td&gt;&lt;td&gt;' + ProductName +
                      '&lt;/td&gt;&lt;td&gt;' + Cost + '&lt;/td&gt;&lt;/tr&gt;').appendTo('#ProductDivWebApi');
                  });
              },
              error: function (xhr) {
                  alert(xhr.responseText);
              }
          });
  </code></pre>
  
  <p>i have added this WEBAPI into MVC 4 project.</p>
  
  <p>its route shows as below:</p>
  
  <pre><code>   public static void RegisterRoutes(RouteCollection routes)
      {
          routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
  
          routes.MapRoute(
              name: "Default",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "ProductManagement", action = "Index", id = UrlParameter.Optional }
          );
        }
  </code></pre>
  
  <p>Please guide</p>