title: RESTful GET with image
body: <p>I have a REST API, and I am adding a new function that allows users to <code>GET</code> some information from a resource based on a barcode image they provide.</p>
  
  <p>My question is: <strong>what is the correct way to do this in terms of best practices?</strong></p>
  
  <p>Below are some of my thoughts regarding the problem.</p>
  
  <p><strong>GET:</strong></p>
  
  <p>Using <code>GET</code>, I would normally specify criteria in the URI like this: <code>foo?name=bar</code>, but passing image data the same way will most likely fail due to the length (<a href="https://stackoverflow.com/questions/417142/what-is-the-maximum-length-of-a-url#answer-417184">looking at this</a>).</p>
  
  <p>According to <a href="https://stackoverflow.com/questions/978061/http-get-with-request-body">these answers</a>, passing data in the body instead of the URI does not seem like a good solution either.</p>
  
  <p><strong>POST:</strong></p>
  
  <p>I could however use a <code>POST</code> request, but this isn't very RESTful, as I am only retrieving information.</p>