File: index.html

package info (click to toggle)
rabbitmq-server 2.8.4-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 8,928 kB
  • sloc: erlang: 52,968; python: 2,846; xml: 1,987; sh: 816; makefile: 683; perl: 86; ruby: 63
file content (521 lines) | stat: -rw-r--r-- 19,035 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
<html>
  <head>
    <title>RabbitMQ Management HTTP API</title>
    <style>
      body { font: 12px Verdana,sans-serif; color: #444; padding: 8px 35px; }
      td, th { font: 12px Verdana,sans-serif; color: #444; }
      h1 { font-size: 2em; }
      h2 { font-size: 1.5em; }
      td.path { font-family: monospace; }
      th { font-size 1em; font-weight: bold; }
      table { border-collapse: collapse; }
      table th, table td { vertical-align: top; border: 1px solid #bbb; padding: 5px; }
      code { background: #ffa; }
      pre { background: black; color: #0f0; padding: 10px; word-wrap: break-word;}
      table pre { background: #ffa; color: black; }
    </style>
  </head>
  <body>
    <h1>RabbitMQ Management HTTP API</h1>

    <h2>Introduction</h2>

    <p>Apart from this help page, all URIs will serve only resources
    of type <code>application/json</code>, and will require HTTP basic
    authentication (using the standard RabbitMQ user database). The
    default user is guest/guest.</p>

    <p>Many URIs require the name of a virtual host as part of the
    path, since names only uniquely identify objects within a virtual
    host. As the default virtual host is called "<code>/</code>", this
    will need to be encoded as "<code>%2f</code>".</p>

    <p>PUTing a resource creates it. The JSON object you upload must
    have certain mandatory keys (documented below) and may have
    optional keys. Other keys are ignored. Missing mandatory keys
    constitute an error.</p>

    <p>Since bindings do not have names or IDs in AMQP we synthesise
    one based on all its properties. Since predicting this name is
    hard in the general case, you can also create bindings by POSTing
    to a factory URI. See the example below.</p>

    <p>Many URIs return lists. Such URIs can have the query string
    parameters <code>sort</code> and <code>sort_reverse</code>
    added. <code>sort</code> allows you to select a primary field to
    sort by, and <code>sort_reverse</code> will reverse the sort order
    if set to <code>true</code>. The <code>sort</code> parameter can
    contain subfields separated by dots. This allows you to sort by a
    nested component of the listed items; it does not allow you to
    sort by more than one field. See the example below.</p>

    <p>You can also restrict what information is returned per item
    with the <code>columns</code> parameter. This is a comma-separated
    list of subfields separated by dots. See the example below.</p>

    <h2>Examples</h2>

    <p>A few quick examples, using the Unix command line
    tool <code>curl</code>:</p>

    <ul>
      <li>
        Get a list of vhosts:
<pre>$ curl -i -u guest:guest http://localhost:55672/api/vhosts
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Tue, 31 Aug 2010 15:46:59 GMT
Content-Type: application/json
Content-Length: 5

[{"name":"/"}]</pre>
      </li>
      <li>
        Get a list of channels, fast publishers first, restricting the info
        items we get back:
<pre>$ curl -i -u guest:guest 'http://localhost:55672/api/channels?sort=message_stats.publish_details.rate&amp;sort_reverse=true&amp;columns=name,message_stats.publish_details.rate,message_stats.deliver_get_details.rate'
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Tue, 12 Oct 2010 10:03:21 GMT
Content-Type: application/json
Content-Length: 6078
Cache-Control: no-cache

[{"connection_details":{"peer_address":"127.0.0.1","peer_port":47340<i>... (remainder elided)</i></pre>
      </li>
      <li>
        Create a new vhost:
<pre>$ curl -i -u guest:guest -H "content-type:application/json" \
  -XPUT http://localhost:55672/api/vhosts/foo
HTTP/1.1 204 No Content
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Fri, 27 Aug 2010 16:56:00 GMT
Content-Type: application/json
Content-Length: 0</pre>
        <p>Note: you must specify <code>application/json</code> as the
        mime type.</p>
        <p>Note: the name of the object is not needed in the JSON
          object uploaded, since it is in the URI. As a virtual host
          has no properties apart from its name, this means you do not
          need to specify a body at all!</p>
      </li>
      <li>
        Create a new exchange in the default virtual host:
<pre>$ curl -i -u guest:guest -H "content-type:application/json" \
  -XPUT -d'{"type":"direct","durable":true}' \
  http://localhost:55672/api/exchanges/%2f/my-new-exchange
HTTP/1.1 204 No Content
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Fri, 27 Aug 2010 17:04:29 GMT
Content-Type: application/json
Content-Length: 0</pre>
        <p>Note: we never return a body in response to a PUT or
        DELETE, unless it fails.</p>
      </li>
      <li>
        And delete it again:
<pre>$ curl -i -u guest:guest -H "content-type:application/json" \
  -XDELETE http://localhost:55672/api/exchanges/%2f/my-new-exchange
HTTP/1.1 204 No Content
Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
Date: Fri, 27 Aug 2010 17:05:30 GMT
Content-Type: application/json
Content-Length: 0</pre>
      </li>
    </ul>

    <h2>Reference</h2>

    <table>
      <tr>
        <th>GET</th>
        <th>PUT</th>
        <th>DELETE</th>
        <th>POST</th>
        <th>Path</th>
        <th>Description</th>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/overview">/api/overview</a></td>
        <td>Various random bits of information that describe the whole
        system.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/nodes">/api/nodes</a></td>
        <td>A list of nodes in the RabbitMQ cluster.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/nodes/<i>name</i></td>
        <td>An individual node in the RabbitMQ cluster.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/extensions</td>
        <td>A list of extensions to the management plugin.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td>X</td>
        <td class="path"><a href="/api/definitions">/api/definitions</a><br/>
                                                    /api/all-configuration
                                                    <em>(deprecated)</em>
        </td>
        <td>
          The server definitions - exchanges, queues, bindings, users,
          virtual hosts, permissions. Everything apart from
          messages. POST to upload an existing set of definitions. Note
          that:
          <ul>
            <li>The definitions are merged. Anything already existing is
            untouched.</li>
            <li>Conflicts will cause an error.</li>
            <li>In the event of an error you will be left with a
            part-applied set of definitions.</li>
          </ul>
          For convenience you may upload a file from a browser to this
          URI (i.e. you can use <code>multipart/form-data</code> as
          well as <code>application/json</code>) in which case the
          definitions should be uploaded as a form field named
          "file".
        </td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/connections">/api/connections</a></td>
        <td>A list of all open connections.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td>X</td>
        <td></td>
        <td class="path">/api/connections/<i>name</i></td>
        <td>An individual connection. DELETEing it will close the
        connection.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/channels">/api/channels</a></td>
        <td>A list of all open channels.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/channels/<i>channel</i></td>
        <td>Details about an individual channel.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/exchanges">/api/exchanges</a></td>
        <td>A list of all exchanges.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/exchanges/<i>vhost</i></td>
        <td>A list of all exchanges in a given virtual host.</td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/exchanges/<i>vhost</i>/<i>name</i></td>
        <td>An individual exchange. To PUT an exchange, you will need a body looking something like this:
<pre>{"type":"direct","auto_delete":false,"durable":true,"internal":false,"arguments":[]}</pre>
        The <code>type</code> key is mandatory; other keys are optional.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/exchanges/<i>vhost</i>/<i>name</i>/bindings/source</td>
        <td>A list of all bindings in which a given exchange is the source.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/exchanges/<i>vhost</i>/<i>name</i>/bindings/destination</td>
        <td>A list of all bindings in which a given exchange is the destination.</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>X</td>
        <td class="path">/api/exchanges/<i>vhost</i>/<i>name</i>/publish</td>
        <td>
          Publish a message to a given exchange. You will need a body
          looking something like:
          <pre>{"properties":{},"routing_key":"my key","payload":"my body","payload_encoding":"string"}</pre>
          All keys are mandatory. The <code>payload_encoding</code>
          key should be either "string" (in which case the payload
          will be taken to be the UTF-8 encoding of the payload field)
          or "base64" (in which case the payload field is taken to be
          base64 encoded).<br/>
          If the message is published successfully, the response will
          look like:
          <pre>{"routed": true}</pre>
          <code>routed</code> will be true if the message was sent to
          at least one queue.
          <p>Please note that the publish / get paths in the HTTP API are
          intended for injecting test messages, diagnostics etc - they do not
          implement reliable delivery and so should be treated as a sysadmin's
          tool rather than a general API for messaging.</p>
        </td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/queues">/api/queues</a></td>
        <td>A list of all queues.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/queues/<i>vhost</i></td>
        <td>A list of all queues in a given virtual host.</td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/queues/<i>vhost</i>/<i>name</i></td>
        <td>An individual queue. To PUT a queue, you will need a body looking something like this:
<pre>{"auto_delete":false,"durable":true,"arguments":[],"node":"rabbit@smacmullen"}</pre>
        All keys are optional.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/queues/<i>vhost</i>/<i>queue</i>/bindings</td>
        <td>A list of all bindings on a given queue.</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td>X</td>
        <td></td>
        <td class="path">/api/queues/<i>vhost</i>/<i>name</i>/contents</td>
        <td>Contents of a queue. DELETE to purge. Note you can't GET this.</td>
      </tr>
      <tr>
        <td></td>
        <td></td>
        <td></td>
        <td>X</td>
        <td class="path">/api/queues/<i>vhost</i>/<i>name</i>/get</td>
        <td>
          Get messages from a queue. (This is not an HTTP GET as it
          will alter the state of the queue.) You should post a body looking like:
          <pre>{"count":5,"requeue":true,"encoding":"auto","truncate":50000}</pre>
          <ul>
            <li><code>count</code> controls the number of messages to get. You
            may get fewer messages than this if the queue cannot immediately
            provide them.</li>
            <li><code>requeue</code> determines whether the messages will be
            removed from the queue. If requeue is true they will be requeued -
            but their position in the queue may change and
            their <code>redelivered</code> flag will be set.</li>
            <li><code>encoding</code> must be either "auto" (in which case the
            payload will be returned as a string if it is valid UTF-8, and
            base64 encoded otherwise), or "base64" (in which case the payload
            will always be base64 encoded).</li>
            <li>If <code>truncate</code> is present it will truncate the
            message payload if it is larger than the size given (in bytes).</li>
          </ul>
          <p><code>truncate</code> is optional; all other keys are mandatory.</p>
          <p>Please note that the publish / get paths in the HTTP API are
          intended for injecting test messages, diagnostics etc - they do not
          implement reliable delivery and so should be treated as a sysadmin's
          tool rather than a general API for messaging.</p>
        </td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/bindings">/api/bindings</a></td>
        <td>A list of all bindings.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/bindings/<i>vhost</i></td>
        <td>A list of all bindings in a given virtual host.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td>X</td>
        <td class="path">/api/bindings/<i>vhost</i>/e/<i>exchange</i>/q/<i>queue</i></td>
        <td>A list of all bindings between an exchange and a
        queue. Remember, an exchange and a queue can be bound
        together many times! To create a new binding, POST to this
        URI. You will need a body looking something like this:
          <pre>{"routing_key":"my_routing_key","arguments":[]}</pre>
          All keys are optional.
          The response will contain a <code>Location</code> header
          telling you the URI of your new binding.
        </td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/bindings/<i>vhost</i>/e/<i>exchange</i>/q/<i>queue</i>/<i>props</i></td>
        <td>An individual binding between an exchange and a queue.
        The <i>props</i> part of the URI is a "name" for the binding
        composed of its routing key and properties. While you can
        create a binding by PUTing to this URI, it may be more
        convenient to POST to the URI above.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/vhosts">/api/vhosts</a></td>
        <td>A list of all vhosts.</td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/vhosts/<i>name</i></td>
        <td>An individual virtual host. As a virtual host only has a
        name, you do not need an HTTP body when PUTing one of
        these.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/vhosts/<i>name</i>/permissions</td>
        <td>A list of all permissions for a given virtual host.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/users">/api/users</a></td>
        <td>A list of all users.</td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/users/<i>name</i></td>
        <td>An individual user. To PUT a user, you will need a body looking something like this:
<pre>{"password":"secret","tags":"administrator"}</pre>
or:
<pre>{"password_hash":"2lmoth8l4H0DViLaK9Fxi6l9ds8=", "tags":"administrator"}</pre>
        The <code>tags</code> key is mandatory. Either
        <code>password</code> or <code>password_hash</code>
        must be set. Setting <code>password_hash</code> to "" will ensure the
        user cannot use a password to log in. <code>tags</code> is a
        comma-separated list of tags for the user. Currently recognised tags
        are "administrator", "monitoring" and "management".
        </td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/users/<i>user</i>/permissions</td>
        <td>A list of all permissions for a given user.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/whoami">/api/whoami</a></td>
        <td>Details of the currently authenticated user.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path"><a href="/api/permissions">/api/permissions</a></td>
        <td>A list of all permissions for all users.</td>
      </tr>
      <tr>
        <td>X</td>
        <td>X</td>
        <td>X</td>
        <td></td>
        <td class="path">/api/permissions/<i>vhost</i>/<i>user</i></td>
        <td>An individual permission of a user and virtual host. To PUT a permission, you will need a body looking something like this:
<pre>{"configure":".*","write":".*","read":".*"}</pre>
        All keys are mandatory.</td>
      </tr>
      <tr>
        <td>X</td>
        <td></td>
        <td></td>
        <td></td>
        <td class="path">/api/aliveness-test/<i>vhost</i></td>
        <td>
          Declares a test queue, then publishes and consumes a
          message. Intended for use by monitoring tools. If everything
          is working correctly, will return HTTP status 200 with
          body: <pre>{"status":"ok"}</pre> Note: the test queue will
          not be deleted (to to prevent queue churn if this is
          repeatedly pinged).
        </td>
      </tr>
    </table>
  </body>
</html>