Invoke commands

Process a command.

URL: /commands

Method: POST

Success Responses

Code : 200 OK

Payload: command defined as:

{
	"command": "string",
}

It can also contain more properties given by the parameters defined by the command (see Command definitions)

Example 1: Pharo image cleanup

Taking the definition given in Example 1: Pharo image cleanup, the payload the backend will receive should be like this:

{
	"comand": "imageCleanup"
}

The Pharo implementation of the API, could be have some sort of command dispatcher in place based on the command property. For example:

and the particular handler for imageCleanUp:

Note: this is just an example, implemented in Pharo 12, and may be not a good implementation as #cleanUp: has undesired effects on native UI (some progress bar).

Example 2: saving image with a different name

Considering the definition given at Example 2: saving image with a different name, the command sent for processing should look like this:

Again the backend could handle this command by doing something like:

Last updated