# REST API

The brokers Web Management Console makes calls to an underlying REST API to manage the broker. This section provides a brief overview of the REST interface, which can be used directly to monitor and manage the Broker instance although it is still evolving toward being fully considered a seperately supported interface.

The brokers REST interface support traditional REST model which uses the GET method requests to retrieve the information about broker configured objects, DELETE method requests to delete the configured object, PUT to create or update the configured object and POST to perform the configured objects updates not available with the PUT requests.

The table below lists the available REST services with brief description how they can be used.

Rest services

REST Service URL | Description | GET | PUT | POST | DELETE
--- | --- | --- | --- | --- | ---
/rest/broker | Rest service to manage broker instance | Retrieves the details of broker configuration | Updates broker attributes | Not implemented yet | Not implemented yet
/rest/authenticationprovider /rest/authenticationprovider/<authentication provider name> | Rest service to manage authentication providers on the broker | Retrieves the details about authentication providers | Creates or updates authentication providers | Not implemented yet | Deletes authentication providers
/rest/user /rest/user/<authentication provider name>/<user name> | Rest service to manage user account | Retrieves the details about user account | Creates user account, updates user password | Not implemented yet | Deletes user account
/rest/groupprovider /rest/groupprovider/<group provider name> | Rest service to manage group providers | Retrieves the details about group provider(s) | Creates group provider | Not implemented yet | Deletes groups providers
/rest/group /rest/group/<group provider name>/<group name> | Rest service to manage user group | Retrieves the details about user group | Creates group | Not implemented yet | Deletes group
/rest/groupmember /rest/groupmember/<group provider name >/<group name>/<user name> | Rest service to manage group member(s) | Retrieves the details about group member(s) | Add user to group | Not implemented yet | Deletes user from group
/rest/port /rest/port/<port name> | Rest service to manage broker ports(s) | Retrieves the details about the broker port(s) | Creates or updates port | Not implemented yet | Deletes ports
/rest/queue /rest/queue/<virtual host name>/<queue name> | Rest service to manage queue(s) | Retrieves the details about the queue(s) | Creates queue | Not implemented yet | Deletes queue
/rest/exchange /rest/exchange/<virtual host name>/<exchange name> | Rest service to manage exchange(s) | Retrieves the details about the exchange(s) | Creates exchange | Not implemented yet | Deletes exchange
/rest/binding /rest/binding/<virtual host name>/<exchange name>/<queue name>/<binding name> | Rest service to manage binding(s) | Retrieves the details about the binding(s) | Binds a queue to an exchange | Not implemented yet | Deletes binding
/rest/connection /rest/connection/<virtual host name>/<connection name> | Rest service to manage connection(s) | Retrieves the details about the connection(s) | Not implemented yet | Not implemented yet | Not implemented yet
/rest/session /rest/session/<virtual host name>/<connection name>/<session name> | Rest service to manage session(s) | Retrieves the details about the session(s) | Not implemented yet | Not implemented yet | Not implemented yet
/rest/message/<virtual host name>/<queue name> | Rest service to manage messages(s) | Retrieves the details about the messages(s) | Not implemented yet | Copies, moves messages | Deletes messages
/rest/message-content/<virtual host name>/<queue name> | Rest service to retrieve message content | Retrieves the message content | Not implemented yet | Not implemented yet | Not implemented yet
/rest/logrecords | Rest service to retrieve broker logs | Retrieves the broker logs | Not implemented yet | Not implemented yet | Not implemented yet
/rest/sasl | Sasl authentication | Retrieves user current authentication status and broker supported SASL mechanisms | Authenticates user using supported SASL mechanisms | Not implemented yet | Not implemented yet
/rest/logout | Log outs | Log outs user | Not implemented yet | Not implemented yet | Not implemented yet
/rest/accesscontrolprovider | Rest service to manage access control providers | Retrieves the details about access control providers | Creates access control provider | Not implemented yet | Deletes access control provider(s)
/rest/keystore | Rest service to manage KeyStores | Retrieves the details about KeyStore | Creates or updates KeyStore | Not implemented yet | Deletes KeyStore(s)
/rest/truststore | Rest service to manage TrustStore | Retrieves the details about TrustStore | Creates or updates TrustStore | Not implemented yet | Deletes TrustStore(s)
/rest/plugin | Rest service to manage plugins | Retrieves the details about plugins | Updates plugin attributes | Not implemented yet | Not implemented yet

The REST URLs are hierarchical. It is permitted to replace rest URL elements with an "asterisks" in GET requests to denote all object of a particular type. Additionally, trailing object type in the URL hierarchy can be omitted. In this case GET request will return all of the object underneath of the current object.

For example, for binding URL http://localhost:8080/rest/binding/<vhost>/<exchange>/<queue>/<binding> replacing of <exchange> with "asterisks" (http://localhost:8080/rest/binding/<vhost>/*/<queue>/<binding>) will result in the GET response containing the list of bindings for all of the exchanges in the virtual host having the given name and given queue. If <binding> and <queue> are omitted in binding REST URL (http://localhost:8080/rest/binding/<vhostname>/<exchangename>) the GET request will result in returning all bindings for all queues for the given exchange in the virtual host.

Examples of queue creation using curl (authenticating as user admin):

    #create a durable queue
    curl --user admin -X PUT  -d '{"durable":true}' http://localhost:8080/rest/queue/<vhostname>/<queuename>
    #create a durable priority queue
    curl --user admin -X PUT  -d '{"durable":true,"type":"priority"}' http://localhost:8080/rest/queue/<vhostname>/<queuename>

Example of binding a queue to an exchange using curl

    curl --user admin -X PUT  -d '{}' http://localhost:8080/rest/binding/<vhostname>/<exchangename>/<queue-name>/<binding-name>

NOTE: These curl examples utilise unsecure HTTP transport. To use the examples it is first necessary enable Basic authentication for HTTP within the HTTP Management Configuration (it is off by default). For details see