title: ServiceStack: RESTful Resource Versioning
body: <p>I've taken a read to the  <a href="https://github.com/ServiceStack/ServiceStack/wiki/Advantages-of-message-based-web-services">Advantages of message based web services</a> article and am wondering if there is there a recommended style/practice to versioning Restful resources in ServiceStack?  The different versions could render different responses or have different input parameters in the Request DTO.</p>
  
  <p>I'm leaning toward a URL type versioning (i.e /v1/movies/{Id}), but I have seen other practices that set the version in the HTTP headers (i.e Content-Type: application/vnd.company.myapp-v2).  </p>
  
  <p>I'm hoping a way that works with the metadata page but not so much a requirement as I've noticed simply using folder structure/ namespacing works fine when rendering routes.</p>
  
  <p>For example (this doesn't render right in the metadata page but performs properly if you know the direct route/url)</p>
  
  <ul>
  <li>/v1/movies/{id}</li>
  <li>/v1.1/movies/{id}</li>
  </ul>
  
  <p>Code</p>
  
  <pre><code>namespace Samples.Movies.Operations.v1_1
  {
      [Route("/v1.1/Movies", "GET")]
      public class Movies
      {
         ...
      } 
  }
  namespace Samples.Movies.Operations.v1
  {
      [Route("/v1/Movies", "GET")]
      public class Movies
      {
         ...
      }   
  }
  </code></pre>
  
  <p>and corresponding services...</p>
  
  <pre><code>public class MovieService: ServiceBase&lt;Samples.Movies.Operations.v1.Movies&gt;
  {
      protected override object Run(Samples.Movies.Operations.v1.Movies request)
      {
      ...
      }
  }
  
  public class MovieService: ServiceBase&lt;Samples.Movies.Operations.v1_1.Movies&gt;
      {
          protected override object Run(Samples.Movies.Operations.v1_1.Movies request)
          {
          ...
          }
      }
  </code></pre>