Question

I am creating a RESTful web service and some of the resources are computing or processing functions. For instance, it is possible for a user to scale and convert images through the API by submitting an image and receiving the scaled or converted image back.

According to the RESTful Web Services Cookbook, section 2.5, I should use GET:

Treat the processing function as a resource, and use HTTP GET to fetch a
representation containing the output of the processing function. Use query
parameters to supply inputs to the processing function.

This is clear for cases where the inputs are simple (such as the long/lat coordinates of a point). However, should I follow the same advice for larger inputs such as images? As far as I know it is not possible to send this much data as a query parameter.

Was it helpful?

Solution

Use POST. In effect you are doing an Image Upload and processing on the server. Can't think of another way to do it unless the image is already stored on the server.

OTHER TIPS

The image is a resource. Use PUT to put the resource on the server, then GET the resource, supplying parameters indicating your desired size.

Due to protocol limitations on HTTP I advice against it. This is a very valid very viable example of an exception that should be made to this rule.

Check out this link http://support.microsoft.com/default.aspx?scid=KB;en-us;q208427. It says that the maximum URL for IE is 2083 characters

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top