RabbitMQ response for POST : /api/queues/vhost/name/get

2,207 views
Skip to first unread message

Nirmal ர. Kumar

unread,
Apr 27, 2017, 8:11:44 AM4/27/17
to rabbitmq-users
Hey Guys,

I am using management Plugin for RabbitMQ, for writing rest api tests. I am using PostMan. 

Issue is, When POST : /api/queues/vhost/name/get, 
with
Body : {"count":20,"requeue":false,"encoding":"auto"}  -- Raw (Application/json)
Header : COntent-Type : application/json

I don't get any response body. Tests fails.
In Postman console I see " Error : Parse Error" & in Dev console I noticed, 

xml.js:22 Uncaught TypeError: Cannot read property 'code' of undefined(anonymous function) @ xml.js:22arrayMap @ common.js:24430map @ common.js:33012(anonymous function) @ xml.js:22arrayMap @ common.js:24430map @ common.js:33012interceptor @ common.js:40404thru @ common.js:32244(anonymous function) @ common.js:28001arrayReduce @ common.js:24474baseWrapperValue @ common.js:28000lazyValue @ common.js:25620baseWrapperValue @ common.js:27998wrapperValue @ common.js:32500onRunAdded @ xml.js:22wrapper @ common.js:28547handleInternalMessage @ common.js:75684handleElectronMessage @ common.js:75709(anonymous function) @ common.js:75643emitTwo @ events.js:106emit @ events.js:191
xml.js:22 

Can someone help me in getting rid of this error. I need a proper response body. 

Note : For the same test suite, if I run the tests individually, it works properly. If I run the test collection (all at once), it fails.. 

I have used sleep, tried different content-types in header.. Nothing worked . 

If you have encountered this issue or if you know how to resolve this, please share me the information. 
Also, what type of output will this generate? 
POST : /api/queues/vhost/name/get 

o/p in form of json/xml/plain text or something else? 

please do the needful. Thanks!

Lutz Horn

unread,
Apr 27, 2017, 8:59:38 AM4/27/17
to rabbitm...@googlegroups.com
> I am using management Plugin for RabbitMQ, for writing rest api tests.
> I am using PostMan.
>
> Issue is, When POST : /API/QUEUES/_VHOST_/_NAME_/GET,
> with
> Body : {"count":20,"requeue":false,"encoding":"auto"} -- Raw
> (Application/json)
> Header : COntent-Type : application/json
>
> I don't get any response body. Tests fails.

This works fine using your POST body and curl:

> $ curl -i -u guest:guest -H "Content-Type: application/json" -X POST -d
> '{"count":20,"requeue":false,"encoding":"auto"}'
> http://localhost:15672/api/queues/%2f/q1/get
> HTTP/1.1 200 OK
> server: Cowboy
> date: Thu, 27 Apr 2017 12:58:07 GMT
> content-length: 2
> content-type: application/json
> vary: accept, accept-encoding, origin
> Cache-Control: no-cache
> Content-Type: application/json
>
> []

So the response body is application/json as expected.

Regards

Lutz

Nisarg Bhavsar

unread,
Jun 29, 2020, 3:06:11 AM6/29/20
to rabbitmq-users
Hello Lutz,

I have used the same API as you have mentioned 

curl -i -u guest:guest -H 'content-type:application/json' -X POST -d '{"count":5,"ackmode":"ack_requeue_true","encoding":"auto"}' http://localhost:15672/api/queues/%2f/default/get

But it gives an error as below

HTTP/1.1 500 Internal Server Error
content-length: 0

Note: Here I have used the name as default. The default is the queue name.

So can you help me to solve this issue?

Wesley Peng

unread,
Jun 29, 2020, 4:41:16 AM6/29/20
to rabbitm...@googlegroups.com
Hi

Nisarg Bhavsar wrote:
> curl -i -u guest:guest -H 'content-type:application/json' -X POST -d
> '{"count":5,"ackmode":"ack_requeue_true","encoding":"auto"}'
> http://localhost:15672/api/queues/%2f/default/get
>
> But it gives an error as below
>
> *HTTP/1.1 500 Internal Server Error*
> *content-length: 0*

I run the same command as you (replace queue name with mine), it works
correctly.

$ curl -i -u guest:guest -H 'content-type:application/json' -X POST -d
'{"count":5,"ackmode":"ack_requeue_true","encoding":"auto"}'
http://localhost:15672/api/queues/%2f/wes-queue/get
HTTP/1.1 200 OK
cache-control: no-cache
content-length: 2
content-security-policy: script-src 'self' 'unsafe-eval'
'unsafe-inline'; object-src 'self'
content-type: application/json
date: Mon, 29 Jun 2020 08:39:32 GMT
server: Cowboy
vary: accept, accept-encoding, origin

Regards.

Nisarg Bhavsar

unread,
Jun 29, 2020, 8:41:13 AM6/29/20
to rabbitmq-users
Hello Wesley Peng

I have tried as you have given curl API (curl -i -u guest:guest -H 'content-type:application/json' -X POST -d'{"count":5,"ackmode":"ack_requeue_true","encoding":"auto"}' http://localhost:15672/api/queues/%2f/wes-queue/get) but it gives the same error as I had before.

Regards,

Wesley Peng

unread,
Jun 29, 2020, 8:50:34 AM6/29/20
to rabbitm...@googlegroups.com
Your rabbitmq server seems to be not working.
Please provide the error log.

Regards 

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rabbitmq-users/49576ab7-ac70-4090-9066-bd3eda2fc417o%40googlegroups.com.

Nisarg Bhavsar

unread,
Jun 29, 2020, 8:55:48 AM6/29/20
to rabbitmq-users
Hello

When I have run rabbitmqctl status command it gives below output :

Status of node rabbit@RSPLLT294 ...
[1mRuntime [0m

OS PID: 5808
OS: Windows
Uptime (seconds): 22963
RabbitMQ version: 3.8.5
Node name: rabbit@RSPLLT294
Erlang configuration: Erlang/OTP 23 [erts-11.0] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:64]
Erlang processes: 478 used, 1048576 limit
Scheduler run queue: 0
Cluster heartbeat timeout (net_ticktime): 60

[1mPlugins [0m

Enabled plugin file: c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/enabled_plugins
Enabled plugins:

 * rabbitmq_management
 * amqp_client
 * rabbitmq_web_dispatch
 * cowboy
 * cowlib
 * rabbitmq_management_agent

[1mData directory [0m

Node data directory: c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/db/rabbit@RSPLLT294-mnesia
Raft data directory: c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/db/rabbit@RSPLLT294-mnesia/quorum/rabbit@RSPLLT294

[1mConfig files [0m

 * c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/advanced.config

[1mLog file(s) [0m

 * c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/log/rab...@RSPLLT294.log
 * c:/Users/nisarg.bhavsar/AppData/Roaming/RabbitMQ/log/rabbit@RSPLLT294_upgrade.log

[1mAlarms [0m

(none)

[1mMemory [0m

Calculation strategy: rss
Memory high watermark setting: 0.4 of available memory, computed to: 6.8177 gb
other_proc: 0.034 gb (28.11 %)
code: 0.0322 gb (26.63 %)
allocated_unused: 0.0237 gb (19.58 %)
other_system: 0.0161 gb (13.28 %)
plugins: 0.0065 gb (5.39 %)
other_ets: 0.0035 gb (2.91 %)
binary: 0.0016 gb (1.31 %)
atom: 0.0014 gb (1.17 %)
reserved_unallocated: 0.001 gb (0.87 %)
mgmt_db: 0.0005 gb (0.41 %)
metrics: 0.0002 gb (0.18 %)
mnesia: 0.0001 gb (0.07 %)
quorum_ets: 0.0 gb (0.04 %)
msg_index: 0.0 gb (0.03 %)
queue_procs: 0.0 gb (0.02 %)
connection_other: 0.0 gb (0.01 %)
connection_channels: 0.0 gb (0.0 %)
connection_readers: 0.0 gb (0.0 %)
connection_writers: 0.0 gb (0.0 %)
queue_slave_procs: 0.0 gb (0.0 %)
quorum_queue_procs: 0.0 gb (0.0 %)

[1mFile Descriptors [0m

Total: 4, limit: 65439
Sockets: 0, limit: 58893

[1mFree Disk Space [0m

Low free disk space watermark: 0.05 gb
Free disk space: 162.7711 gb

[1mTotals [0m

Connection count: 0
Queue count: 1
Virtual host count: 1

[1mListeners [0m

Interface: [::], port: 49674, protocol: clustering, purpose: inter-node and CLI tool communication
Interface: [::], port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: 0.0.0.0, port: 5672, protocol: amqp, purpose: AMQP 0-9-1 and AMQP 1.0
Interface: [::], port: 15672, protocol: http, purpose: HTTP API
Interface: 0.0.0.0, port: 15672, protocol: http, purpose: HTTP API

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages