RabbitMQ Management HTTP api--official documentation

Source: Internet
Author: User
Tags rabbitmq

Introduction

Apart from this help page, all URIs would serve only resources of type application/json , and would require HTTP Basic authentication (U Sing the standard RabbitMQ user database). The default user is guest/guest.

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

Puting a resource creates it. The JSON object you upload must has certain keys (documented below). Other keys is ignored. Missing keys consitute an error.

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

Caveats

These caveats apply to the current development version of the the Management API. In the future they'll be fixed.

    • argumentsFields is ignored everywhere. You cannot the Create a queue, exchange or binding with arguments. Queues, exchanges or bindings with arguments won ' t show those arguments.
    • Permissions is only enforced sporadically. If a user can authenticate with the HTTP API, they can do anything.
    • There is many monitoring-related information items in the objects returned from GET requests. They is undocumented and subject to change.
Examples

A Few quick examples, using the Unix command line tool curl :

  • Get a list of vhosts:
    $ curl-i-u guest:guest http://localhost:55672/api/vhostsHTTP/1.1 okserver:mochiweb/1.1 webmachine/1.7 ( Participate in the frantic) Date:tue, 15:46:59 gmtcontent-type:application/jsoncontent-length:5["/"]
  • Create a new vhost:
    $ curl-i-u guest:guest-h "Content-type:application/json"   -xput http://localhost:55672/api/vhosts/fooHTTP/1.1 204 No contentserver:mochiweb/1.1 webmachine/1.7 (participate in the frantic) Date:fri, 16:56:00 GMTContent-T ype:application/jsoncontent-length:0

    Note:you must specify as the application/json MIME type.

    Note:the name of the object is not needed in the JSON object uploaded, since it's in the URI. As a virtual host have no properties apart from it name, this means you does not need to specify a body at all!

  • Create a new Exchange in the default virtual host:
    $ curl-i-u guest:guest-h "Content-type:application/json"   -xput-d ' {"type": "Direct", "Auto_delete": false, " Durable ": true," arguments ": []} '   http://localhost:55672/api/exchanges/%2f/my-new-exchangeHTTP/1.1 204 No contentserver:mochiweb/1.1 webmachine/1.7 (participate in the frantic) Date:fri, 17:04:29 Gmtcontent-type:ap plication/jsoncontent-length:0

    Note:we never return a body in response to a PUT or DELETE, unless it fails.

  • and delete it again:
    $ curl-i-u guest:guest-h "Content-type:application/json"   -xdelete http://localhost:55672/api/exchanges/%2f/ my-new-exchangehttp/1.1 204 No contentserver:mochiweb/1.1 webmachine/1.7 (participate in the frantic) Date:fri, 20 Ten 17:05:30 gmtcontent-type:application/jsoncontent-length:0
Reference
GET PUT DELETE POST Path Description
X /api/overview Various random bits of information that describe the whole system.
X /api/connections A List of all open connections.
X X /api/connections/name An individual connection. Deleteing it would close the connection.
X /api/channels A List of all open channels.
X /api/channels/Channel Details about an individual channel.
X /api/exchanges A List of all exchanges.
X /api/exchanges/vhost A list of all exchanges in a given virtual host.
X X X /api/exchanges/vhost/name An individual exchange. To PUT the exchange, you'll need a body looking something like this:
{"type": "Direct", "Auto_delete": false, "durable": true, "arguments": []}
X /api/exchanges/vhost/name/bindings A list of all bindings on a given exchange.
X /api/queues A List of all queues.
X /api/queues/vhost A list of all queues in a given virtual host.
X X X /api/queues/vhost/name An individual queue. To PUT a queue, you'll need a body looking something like this:
{"Auto_delete": false, "durable": true, "arguments": []}
X /api/queues/vhost/queue/bindings A list of all bindings on a given queue.
X /api/bindings A list of all bindings.
X /api/bindings/vhost A list of all bindings in a given virtual host.
X     X /api/bindings/ vhost / queue< /em>/ Exchange A list of all bindings between a queue and an exchange. Remember, a queue and an exchange can be bound together many times! To create a new binding, the POST to the this URI. You'll need a body looking something like this:
 {"Routing_key": "My_routing_key", "arguments": []} 
the response would contain a  location  header telling the URI of the your new binding.
X X X /api/bindings/vhost/queue/Exchange/props An individual binding between a queue and an exchange. The props part of the URI was a "name" for the binding composed of its routing key and properties. While your can create a binding by puting to this URI, it may be more convenient to POST to the URI above.
X /api/vhosts A List of all vhosts.
X X X /api/vhosts/name An individual virtual host. As a virtual host is only have a name, you don't need an HTTP body when puting one of these.
X /api/users A List of all users.
X X X /api/users/name An individual user. To PUT a user, you'll need a body looking something like this:
{"Password": "Secret"}
X /api/users/User/permissions A list of all permissions for a given user.
X /api/permissions A List of all permissions to all users.
X X X /api/permissions/vhost/user An individual permission of a user and virtual host. To PUT a permission, you'll need a body looking something like this:
{"Scope": "Client", "Configure": ". *", "write": ". *", "read": ". *"}

Original address: http://hg.rabbitmq.com/rabbitmq-management/raw-file/3646dee55e02/priv/www-api/help.html

RabbitMQ Management HTTP api--official documentation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.