title: How should Transient Resources be retrieved in a RESTful API
body: <p>For a while I was (wrongly) thinking that a RESTful API just exposed CRUD operation to persisted entities for a web application. When you code something up in "the real world" you soon find out that this is not enough. For example, a bank account transfer doesn't have to be a persisted entity. It could be a transient resource where you <code>POST</code> to <code>/transfers/</code> and in the payload you specify the details:</p>
  
  <pre><code>{"accountToCredit":1234, "accountToDebit":5678, "amount":10}
  </code></pre>
  
  <p>Using <code>POST</code> here makes sense because it changes the state on the server ($10 moves from one account to another every time this <code>POST</code> occurs).</p>
  
  <p>What should happen in the case where it doesn't affect the server? The simple first answer would be to use <code>GET</code>. For example, you want to get a list of savings and checking accounts that have less than $100. You would then call something like <code>GET</code> to <code>/accounts/searchResults?minBalance=0&amp;maxBalance=100</code>. What happens though if your search parameter need to use complex objects that wouldn't fit in the maximum length of a <code>GET</code> request.</p>
  
  <p>My first thought was to use <code>POST</code>, but after thinking about it some more it should probably be a <code>PUT</code> since it isn't changing the state of the server, but from my (limited) understanding I always though of <code>PUT</code> as updating a resource and <code>POST</code> as creating a resource (like creating this search results). So which should be used in this case?</p>
  
  <p>I found the following links which provide some information but it wasn't clear to me what should be used in the different cases:</p>
  
  <p><a href="https://stackoverflow.com/questions/1309058/transient-rest-representations/1309120#1309120">Transient REST Representations</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5020704/how-to-design-restful-search-filtering">How to design RESTful search/filtering?</a></p>
  
  <p><a href="https://stackoverflow.com/questions/207477/restful-url-design-for-search">RESTful URL design for search</a></p>