|  |  | rest resin administration
 Starting with version 4.0.26 Resin provides REST interface. Simple and
        secure, it can be used for integration with services such as RightScale®
        and others.
       
      REST interface is provided for convenience of integration with
      administration and monitoring tools that are capable of using
      REST as integration protocol. Resin's set of REST actions covers
      functionality available via CLI and adds an extra action that allows
      retrieving Resin statistics data.
       
        By default Resin REST is disabled. Default configuration also requires
        secure protocol.
       REST actions, available via the interface, are required to be invoked
        with either GET or POST methods. Depending on the effect on the server
        the proper HTTP method is required: actions change state of the Resin's
        internal objects require POST method. Other actions must use GET.
       By default the interface is disabled. Un-commenting line
        rest_admin_enable : truein resin properties enables the REST service. By default, the connection is required to be made over a secure
        protocol(HTTPS). Relaxing the secure constraint can be done with setting
        rest_admin_securetotrue. Example: enabling Resin Secure REST interface 
        # Enable Resin REST Admin
        rest_admin_enable : true
        # Require SSL for REST Admin
        rest_admin_secure : true
      Resin REST Servlet is registered in
        cluster-default.xmlfile (see excerpt below for a reference). Reference: registered REST Servlet 
        <resin:if test="${rest_admin_enable}">
          <web-app id="/resin-rest"
                      root-directory="${resin.root}/doc/resin-rest">
            <resin:BasicLogin realm-name="resin"/>
            <resin:Allow url-pattern="/*">
              <resin:IfUserInRole role="resin-admin"/>
            </resin:Allow>
            <servlet-mapping url-pattern="/*"
                                servlet-class="com.caucho.admin.servlet.AdminRestServlet">
              <init>
                <require-secure>${rest_admin_secure}</require-secure>
              </init>
            </servlet-mapping>
          </web-app>
        </resin:if>
      The registration can be augmented further with
        resin:IfNetworkconstraint to limit access to specific IPs only. Adding the constraint
        must be considered when enabling access over HTTP. Invoking REST action requires constructing an HTTP request with proper
        url and body. REST action is encoded in the URL. Base of the URL is the
        address of the Resin server itself combined with the context name of the
        Resin REST web-app. The defaut URL is
        http://localhost:8080/resin-rest. Concatenating the URL
        with action name creates a complete Resin REST service URL. e.g.http://localhost:8080/resin-rest/jmx-list Example: invoking Resin REST jmx-list action 
        ~$curl --user admin:secret http://localhost:8080/resin-rest/jmx-list
      interpreting Resin REST Service resultsResin REST replies with JSON Objects encoded as a String. Since
        integration requires interchangeable data format JSON, with the
        multitudes of available parsers in various languages, is a proper
        choice. The output below has been post-formatted and shortened for easy
        reading.
       Example: invoking Resin REST jmx-list action 
~$curl --user admin:secret \
       'http://localhost:8080/resin-rest/jmx-list?pattern=resin:type=Resin&print-values=true'
        [
          {
            "attributes":[
              ...
              {
                "name":"ConfigFile",
                "value":"/Volumes/projects/caucho/trunk/resin/conf/resin.xml"
              },
              {
                "name":"LogDirectory",
                "value":"/Volumes/projects/caucho/trunk/resin/log"
              },
              {
                "name":"ResinHome",
                "value":"/Volumes/projects/caucho/trunk/resin/"
              },
              {
                "name":"RootDirectory",
                "value":"/Volumes/projects/caucho/trunk/resin/"
              }
            ],
           "name":"resin:type=Resin"
          }
          ...
        ]
      REST actions| ACTION | HTTP METHOD | DESCRIPTION | 
|---|
 | config-cat | GET | prints configuration file deployed with config-deployaction or command |  | config-deploy | POST | deploys configuration |  | config-ls | lists files deployed via config-deploycommand or action |  | config-undeploy | POST | Un-deploys configuration deployed with config-deploy action |  | deploy-copy | POST | copies an application from one context to another |  | deploy-list | GET | lists all applications deployed on a server |  | jmx-call | POST | calls MBean's method |  | jmx-dump | GET | dump all MBean attributes and values |  | jmx-list | GET | lists MBeans, attributes and operations |  | jmx-set | POST | sets value of a jmx attribute |  | license-add | POST | adds a license file |  | list-restarts | GET | lists Resin server restarts |  | log-level | POST | configures log level for one or more loggers |  | pdf-report | GET | produces and returns pdf-report |  | stats | GET | prints stats collected by Resin |  | thread-dump | GET | produces a thread dump |  | user-add | POST | adds an user with Resin administrator privileges |  | user-list | GET | lists users with Resin administrator privileges |  | user-remove | POST | removes user added with user-addcommand or action |  | web-app-deploy | POST | deploys an application to Resin |  | web-app-restart | POST | restarts deployed application |  | web-app-start | POST | starts deployed application |  | web-app-stop | POST | stops deployed application |  | web-app-undeploy | POST | undeploys an application deployed with web-app-deploycommand |  Command config-deploy deploys a configuration archive from an input
        stream to Resin cluster. Config-deploy action works with Resin's import
      tag, which imports from a cloud:/resin-inf/+.xmlwith
      default configuration (resin.xml) 
          &resin:import fileset="cloud:/resin-inf/+.xml" recover="true"/>
      
 Action expects the configuration to be streamed in the POST request body. 
        curl -H "Content-Type: " --user admin:secret \
             --data-binary @/tmp/my-conf.jar \
             'http://localhost:8080/resin-rest/config-deploy'
       A value other than "application/x-www-form-urlencoded" must be
        specified as a value for Content-Type header.config-deploy options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to deploy to |  |  | stage | stage of the server's deployment | production |  | version | version e.g.(1.0.0) |  |  | message | commit message |  |  Similar to a unix 'cat' command config-cat prints content of a
        configuration file deployed to Resin using config-deploy action. config-cat options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | Defaults to current server |  | name | full name of the configuration file inside the deployed
            configuration archive | required |  | stage | stage of the server's deployement | Defaults to 'production' |  Action config-ls lists files deployed with config-deploy action. config-ls options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | Defaults to the current server |  | name | name of the file or directory |  |  | stage | stage of the server's deployment | production |  | version | version e.g.(1.0.0) |  |  Action config-undeploy un-deploys configuration deployed with
        config-deploy action. config-undeploy options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to query |  |  | stage | stage of the server's deployment | production |  | version | version e.g.(1.0.0) |  |  | message | commit message |  |  Action jmx-list lists MBeans with (optionally) attributes and values. jmx-list options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | Defaults to the current server |  | pattern | pattern used to query the MBeanServer e.g. java.lang:* | resin:* |  | print-attributes | prints attributes | false |  | print-values | prints values (overrides print-attributes) | false |  | print-operations | prints operations | false |  | print-all-beans | matches all MBeans | false |  | print-platform-beans | matches only java.lang:* MBeans | false |  Action jmx-call invokes an action on an MBean. jmx-call options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | Defaults to the current server |  | pattern | JMX ObjectName pattern used to uniquely identify an MBean | required |  | operation | name of operation (method) to invoke | required |  | operation-index | when multiple methods are named with the same name, help to choose
            the method to invoke | 0 |  | values | space separated list of arguments | required |  Action jmx-dump produces a complete dump of JMX tree with attributes and values. jmx-dump options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  Action jmx-set sets a value on an JMX JBean's attribute.  Attribute name must be Capitalized (e.g. Foo not foo)jmx-set options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | pattern | JMX ObjectName pattern that uniquely identifies an MBean | required |  | attribute | name of the attribute | required |  | value | new value for the attribute | null |  Action license-add writes a license file into a remote Resin's license directory.  The license file should be passed in the request body.license-add options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | Defaults to the current server |  | overwrite | overwrites the file specified in 'to' if the file exists | false |  | to | name of the file to write to | required |  | restart | optionally restarts server after license is deployed | false |  
        curl -H "Content-Type: " --user admin:secret \
              --data-binary @/tmp/my-conf.jar \
              'http://localhost:8080/resin-rest/config-deploy'
       A value other than "application/x-www-form-urlencoded" must be
        specified as a value for Content-Type header.Action list-restarts prints restarts since a start of specified
        period.
       list-restarts options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | period | lookback (from now) period. e.g. '7D' | 7 days (specifed as 7D) |  list server restarts 
        curl --user admin:secret
        'http://localhost:8080/resin-rest/list-restarts'
      Action log-level configures logging level for specified list of
        loggers.
       log-level options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | loggers | space separated list of loggers | root logger ('') and 'com.caucho' logger |  | level | new logging level(all, finest, finer, fine, config, info, warning,
            severe, off ) | required |  | active-time | specifies period of time the new value will be active | until next restart |  Action pdf-report creates a PDF report and optionally returns the PDF
        file with the Response.
       pdf-report options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | required |  | report | base name for the report | Snapshot |  | period | reporting period | 1 Day (1D) |  | log-directory | directory to write the report to on the server side | Resin's log directory |  | profile-time | turns execution profiler on for a specified time e.g. 20s (20
            seconds) |  |  | sample-period | specifies sampling rate e.g. 150ms | 100ms |  | snapshot | includes JMX, thread dump and memory analysis in the report | false |  | watchdog | specifies period as the starting of the server | false |  | load-pdf | Streams PDF Report file with the response | false |  creating and loading pdf report 
        curl --user admin:secret
        'http://localhost:8080/resin-rest/pdf-report?snapshot=true&load-pdf=true' > my-report.pdf
      Action stats returns statistics that can be used for building graphs.
      The JSON formatting is compatible with jquery-flot graph solution() stats options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | server to query | required |  | meters | comma separated list of meters e.g.(JVM|Memory|Heap Memory Used, ) |  |  | period | time span from now e.g. 2D (2 days) | 7D |  querying Memory statistics 
curl --user admin:secret \
     'http://localhost:8080/resin-rest/stats?meters=JVM|Memory|Heap%20Memory%20Used'
            [
              {
              "label":"00|JVM|Memory|Heap Memory Used",
              "data": [
                [1330983197106,0.0],
                [1330983257158,8.5000192E7],
                [1330983299997,8.5000192E7],
                [1330983359987,8.5000192E7],
                [1330983419984,8.5000192E7],
                [1330983479994,8.5000192E7],
                [1330983539986,8.5000192E7],
                [1330983599990,8.5000192E7],
                [1330983659998,8.5000192E7],
                [1330983719999,8.5000192E7],
                [1330983779994,8.5000192E7],
                [1330983839995,8.5000192E7],
                [1330983900012,8.5000192E7],
                [1330983959983,8.5000192E7],
                [1330984019988,8.5000192E7],
                [1330984079986,8.5000192E7],
                [1330984139984,8.5000192E7],
                [1330984199999,8.5000192E7],
                [1330984259992,8.5000192E7],
                [1330984319991,8.5000192E7],
                [1330984379991,8.5000192E7],
                [1330984439987,8.5000192E7],
                [1330984499994,8.5000192E7],
                [1330984559984,8.5000192E7],
                [1330984619996,8.5000192E7],
                [1330984679996,8.5000192E7],
                [1330984739988,8.5000192E7],
                [1330984799980,8.5000192E7],
                [1330984859999,8.5000192E7],
                [1330984919990,8.5000192E7],
                [1330984979992,1.07880448E8]
              ]
              }
            ]
          
 A complete list of Meters can be looked up in Resin-Admin's graphs
        section.Action thread-dump produces and returns thread dump. thread-dump options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  Action user-add adds administrative user. user-add options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to query |  |  | user | specifies user name | required |  | password | specifies password | required |  Action user-list lists administrative user. user-list options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to query |  |  Action user-remove removes administrative user added with user-add
        action.
       user-remove options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to query |  |  | user | specifies user name | required |  Action web-app-deploy deploys a web application. web-app-deploy options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server |  | triad server to deploy to |  | context | web application context | required |  | host | host to deploy to | 'default' |  | stage | state to deploy to | production |  | version | version e.g. 1.0.0 |  |  | message | commit message |  |  deploying an application via REST 
        curl -H "Content-Type: " \
             --data-binary @/tmp/my-app.war \
             --user admin:secret \
             'http://localhost:8080/resin-rest/web-app-deploy?context=foo'
      Action deploy-copy is used to copy an application from one context to
        another. Application copied from source context to a target context. The
        target context is started upon completion of the operation. deploy-copy options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server | defaults to the current server |  | source-context | context to copy an application from e.g. /foo | required |  | source-host | host to copy an application from |  |  | source-stage | stage of the source deployment | production |  | source-version | version of the source deployment | HEAD |  | target-context | context to copy an application to e.g. /bar | required |  | target-host | host to copy an application to |  |  | target-stage | stage of the target deployment |  |  | target-version | version of the target deployment |  |  | message | commit message |  |  Action deploy-list lists deployed applications. deploy-list options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  Action web-app-restart restarts an application. web-app-restart options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | tag | tag to restart e.g. (production/webapp/default/foo) | required |  | context | context to restart | required |  | stage | deployment stage of the context | production |  | host | deployment host | 'default' |  | version | deployment version |  |  Action web-app-start starts web application. web-app-start options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | tag | tag to start e.g.(production/webapp/default/foo) | required |  | context | context to start | required |  | stage | deployment stage of the context | required |  Action web-app-stop stops web application. web-app-stop options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | cluster server to query | defaults to the current server |  | tag | tag to start e.g.(production/webapp/default/foo) | required |  | context | context to stop | required |  | stage | deployment stage of the context | required |  Action web-app-undeploy un-deploys deployed web application. web-app-undeploy options| PARAMETER | DESCRIPTION | DEFAULT/REQUIRED | 
|---|
 | server | triad server to query |  |  | context | context to undeploy | required |  | host | context deployment host | 'default' |  | stage | context deployment stage | production |  | version | version |  |  | message | commit message |  |  
 | Copyright © 1998-2012 Caucho Technology, Inc. All rights reserved. Resin ® is a registered trademark. Quercustm, and Hessiantm are trademarks of Caucho Technology. | 
 |