HTTP (JSON-like) API

    This is a digest of http://lists.jboss.org/pipermail/jboss-as7-dev/2011-February/000491.html for easier finding.

     

    In a nutshell this is another view on the management API available over the http connector installed in standalone.xml/host.xml, normally on port 9990.

     

        <management>

            <security-realms>

                <security-realm name="ManagementRealm">

                    <authentication>

                        <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" plain-text="true"/>

                    </authentication>

                </security-realm>

            </security-realms>

            <management-interfaces>

                <native-interface interface="management" port="9999"/>

                <http-interface interface="management" port="9990"/>

            </management-interfaces>

        </management>

     

    GET requests

     

    The GET URL form is a mapping of operation addresses, with a few

    supported read operations, and support for mapping top level values via

    query parameters. The default operation is read-resource. So in

    other words you can dump the whole management tree like so:

    http://localhost:9990/management?recursive

     

    To make the output of any GET operation easier to read you can append the "json.pretty" parameter to the end, e.g.:

    http://localhost:9990/management?operation=resource&recursive&json.pretty

     

     

    The lack of additional /'s defaults to the root node.

    The lack of an "operation" defaults to the read-resource operation.

    The "recursive" is mapped to the recursive as a boolean, a lack of an

    assignment defaults to "true"

     

    The attributes of the http web connector can be retrieved with:

    http://localhost:9990/management/subsystem/web/connector/http

     

    A single attribute can be retrieved by specifying the attribute

    operation and the attribute name:

    http://localhost:9990/management/subsystem/logging/console-handler/CONSOLE?operation=attribute&name=autoflush

     

    The full description of the model can be retrieved using the

    read-resource-description operation like so:

    http://localhost:9990/management?operation=resource-description&recursive&operations

     

    POST requests

     

    You can also do post support for both JSON and DMR Encoded:

     

    curl -H Content-Type:\ application/json -d '{"operation":"read-resource","address":[],"json.pretty":1}'

    http://localhost:9990/management

     

    curl -H Content-Type:\ application/dmr-encoded -d

    bwAAAAMACW9wZXJhdGlvbnMADXJlYWQtcmVzb3VyY2UAB2FkZHJlc3NsAAAAAAAHcmVjdXJzZVoB

    http://localhost:9990/management