Application Control
December 9, 2021 ยท View on GitHub
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:
shutdownGracefully 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 OKwhen used for Procedure Calls202 Acceptedwhen used for Notifications
Notification
POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"jsonrpc" : "2.0",
"method" : "shutdown"
}
HTTP/1.1 202 Accepted
Remote Procedure Call
POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"jsonrpc" : "2.0",
"id" : 1,
"method" : "shutdown"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"jsonrpc": "2.0",
"result": "Remote SHUTDOWN command was received.",
"id": 1
}
Unknown Method
POST /operations/application-control HTTP/1.1
Content-Type: application/json
Accept: application/json
{
"jsonrpc" : "2.0",
"id" : 1,
"method" : "xxx"
}
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
}
}