I developed an image processing API for my colleague. It uses Ruby (RestClient) as a client.
$ curl -i -X GET http://abc.com:8080/api/v0/compare-19 HTTP/1.1 303 See Other Date: Thu, 10 Jan 2013 08:02:02 GMT Content-Type: application/json Location: http://abc.com:8080/result/856caf71-df10-4b9e-a981-4785de2f4854.png Transfer-Encoding: chunked Server: Jetty(8.1.3.v20120416) { "id": 19, "state": "completed", "timestamp": "2013-01-10T00:01:13.755-08:00", "resultImage": "856caf71-df10-4b9e-a981-4785de2f4854.png", "passcode": "AXBD" }
He wanted to capture the "state" and "password", however, according to the RESTClient documentation, the ruby ββprogram is immediately redirected to http://abc.com:8080/result/856caf71-df10-4b9e-a981-4785de2f4854.png .
Exceptions (see www.w3.org/Protocols/rfc2616/rfc2616-sec10.html) for results code between 200 and 207 a RestClient::Response will be returned for results code 301, 302 or 307 the redirection will be followed if the request is a get or a head for result code 303 the redirection will be followed and the request transformed into a get for other cases a RestClient::Exception holding the Response will be raised, a specific exception class will be thrown for know error codes
My question is, is this the right way to give a REST answer?
source share