Skip to content

Latest commit

 

History

History
112 lines (90 loc) · 2.01 KB

ApplicationControl.md

File metadata and controls

112 lines (90 loc) · 2.01 KB

Application Control

One of the operational plugins. It allows to remotely control the running application.

This plugin is disabled by default and allows configuring the available commands. This configuration is made via the #operations config.

For example:

Dictionary new
  at: #operations put: (
    Dictionary new
      at: 'application-control' put: {#enabled -> true. #commands -> #('shutdown')} asDictionary;
      yourself
    );
  yourself

To get a list of supported commands print the result of ApplicationControlPlugin availableCommands collect: #methodName as: Array.

Available commands:

  • shutdown Gracefully shutdowns the running application

API

This is a JSON RPC API.

Running

  • Endpoint: /application-control
  • Allowed HTTP methods: POST
  • Supported media types: application/json
  • Authentication: Required
  • Authorization: Requires execute:application-control
  • Expected Responses:
    • 200 OK when used for Procedure Calls
    • 202 Accepted when used for Notifications

Examples

Notification

Request

POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "jsonrpc" : "2.0",
  "method" : "shutdown"
}

Response

HTTP/1.1 202 Accepted

Remote Procedure Call

Request

POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "method" : "shutdown"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "result": "Remote SHUTDOWN command was received.",
  "id": 1
}

Unknown Method

Request

POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "method" : "xxx"
}

Response

HTTP/1.1 200 OK
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "message": "The method does not exist / is not available.",
    "code": -32601
  }
}