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