[rabbitmq-discuss] [RabbitMQ - HTTP API] Encoding key is mandatory in order to get messages from a queue
Salvatore Piccione
salvo.picci at gmail.com
Wed May 4 16:12:51 BST 2011
Hello,
I'm working with RabbitMQ 2.4.1 for Windows and using the HTTP API to
interact with the RabbitMQ server. I notice that, when I try to get messages
from a queue, I have to specify the payload encoding - even if the HTTP API
Specification (
http://hg.rabbitmq.com/rabbitmq-management/raw-file/rabbitmq_v2_4_1/priv/www-api/help.html)
doesn't list it in the mandatory keys - and the only accepted value is
"base64".
Please, find below the tests I performed:
1: Specify in the request body all the mandatory fields listed in the HTTP
API Specification
REQUEST: POST /api/queues/%2f/queue1/get
REQUEST BODY: {"count":10,"requeue":false}
Response: HTTP/1.1 400 Bad Request
Date: Wed, 04 May 2011 14:47:48 GMT
Content-Length: 59
Content-Type: text/html
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
response body: {"error":"bad_request","reason":{"key_missing":"encoding"}}
2. Specify in the request body all the mandatory fields (including
"encoding" but using "string" as value)
REQUEST: POST /api/queues/%2f/queue1/get
REQUEST BODY: {"count":10,"requeue":false,"encoding":"string"}
Response: HTTP/1.1 400 Bad Request
Date: Wed, 04 May 2011 15:03:03 GMT
Content-Length: 58
Content-Type: text/html
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
response body: {"error":"bad_request","reason":["bad_encoding","string"]}
3. Specify in the request body all the mandatory fields (including
"encoding" but using "base64" as value)
REQUEST: POST /api/queues/%2f/queue1/get
REQUEST BODY: {"count":10,"requeue":false,"encoding":"base64"}
Response: HTTP/1.1 200 OK
content-type: application/json
Date: Wed, 04 May 2011 15:05:14 GMT
Content-Length: 2
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Cache-Control: no-cache
response body: []
Case 1 raises an error because of the lack of a mandatory field (the payload
encoding).
Case 2 raises an error because of a bad "encoding" value even if when
publishing a message into an exchange the values allowed for the
"payload_encoding" key are either "string" or "base64".
Case 3 works as expected.
Is there something wrong in my requests or there is a problem on the server
side?
Regards,
Salvatore
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20110504/8df63a4f/attachment.htm>
More information about the rabbitmq-discuss
mailing list