title: Web API httpget with many parameters
body: <p>I am trying to create my first REST service using WEB API to replace some of my postbacks in a web forms asp.net project. In the web forms project, when I browse to a new web page, I always get an ASP.net Application variable and a querystring value that helps me determine which database to connect to. In this old app, it connects to several different databases that all have the same schema and database objects but the data is different in each database</p>
  
  <p>I am not sure the best way to pass these variables to a REST Service or if they should be part of the route or some other method.</p>
  
  <p>So in a REST method like the one below</p>
  
  <pre><code>    // GET api/&lt;controller&gt;/5
      public string GetCategoryByID(int id)
      {
          return "value";
      }
  </code></pre>
  
  <p>I can get the category id and pass that to my database layer, but I also need the two variables mentioned above. I will need to obtain these variables in every call to my REST api in order to access the appropriate database. Should I use something like the following:</p>
  
  <pre><code>    // GET api/&lt;controller&gt;/5
      public string GetCategoryByID(int id, string applicationEnvironment, string organization)
      {
          return "value";
      }
  </code></pre>
  
  <p>Or should they be part of the route with something like this: </p>
  
  <p>api/{appEnvironment}/{organization}/{controller}/{id}</p>
  
  <p>This seems like a simple problem, but I am having trouble figuring out a solution.</p>