Appway exposes simple resources using a REST API to obtain information about Appway's release version and state, and to initialize a cluster-wide shutdown.
Before using the REST interface, you must enable it and configure authorization and authentication methods. Go to System Configuration > Configuration Properties > Edit Server Configuration (top left menu icon).
Changes to the configuration properties below are active immediately; no system restart is required.
| Configuration property | Description |
|---|
nm.rest.service.enabled Boolean | Enable Appway's REST interface by setting this property to true. It is disabled by default. Example:
nm.rest.service.enabled = true Default: false |
nm.rest.service.auth.ips String | Restrict access to the REST interface based the client's IP address. Enter a comma-separated list of IP addresses. You can use the star character (*) as a wildcard. Examples:
nm.rest.service.auth.ips = 127.0.0.1,194.66.82.11,10.0.*
nm.rest.service.auth.ips = * Default value: 127.0.0.1,0:0:0:0:0:0:0:1 |
nm.rest.service.auth.login Enum | Specify the login method for REST clients:- local: Accept only local users and check against password stored in user database
- webapp: Use programmatic login method provided by the application server (requires support for servlet specification 3.0)
nm.rest.service.auth.login = webapp Default value: webapp |
nm.rest.service.auth.role Role | Restrict access to the REST interface based on a user's role, e.g. Administrator, User, or another role defined in the application server. By default, no role is specified, meaning that a resource requiring authorization (e.g. /cluster/shutdown) cannot be called. Example:
nm.rest.service.auth.role = Administrator Default value:<empty> |
When executing a REST call, any access restrictions that apply are verified in the following order:
- IP address match
- User authentication
- Role match
Appway's REST interface currently enables you to execute three types of GET requests, none of which require paramenters:
/version/application/state/cluster/shutdown
To call a resource, use the following URI syntax:
http://${server}:${port}/${contextPath}/rest/${resourcePath}
Example:
http://localhost:8080/appway/rest/cluster/shutdown
| Resource path | Description |
|---|
/version | Returns the version of the Appway installation as a plain text string, e.g. '6.1.6'. No authentication is required: this resource can be called by any user regardless of role configuration. However, restrictions on IP addresses do apply. |
/application/state | Returns information about the state the Appway web application. Possible values are:UNKNOWNBEFORE_STARTSTARTINGRUNNINGSTOPPINGDONE
Note: This query applies to the whole cluster and cannot be used to check if a specific node in the cluster is still running. |
/cluster/shutdown | Initializes a cluster-wide shutdown, bringing all nodes into a status where stopping the application server or killing the JVM causes no rebalancing across nodes. Returns OK as a plain text string after the shutdown was successfully completed. For more information on shutting down a cluster installation, see Shut down a large cluster. |