Overview

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.

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.

enabling the interface

By default the interface is disabled. Un-commenting line
rest_admin_enable : true
in 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_secure
totrue.

The registration can be augmented further with
resin:IfNetwork
constraint to limit access to specific IPs only. Adding the constraint
must be considered when enabling access over HTTP.

invoking REST action

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 results

Resin 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.

config-deploy

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/+.xml with
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.

deploy-copy

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.