Triggering Commands

From Edge Manager with Custom Commands

Once the commands, handlers, and capabilities have been created, the next step is to trigger them remotely from Edge Manager. (See Adding a Custom Command.)

After (enrolling the device) into your Edge Manager instance, navigate to the Commands tab. From the Action drop down menu select Add.
  • Enter a name and description that clearly indicates what the commmand does.
  • Set the COMMAND and HANDLER fields to match what is set in the JSON, in this case 'date' and 'host' respectively.
  • Select Has output in order to see the results of this command from the system.

You can then execute the command (see Executing Commands).

The new command will be included in the Commands History table. The status should cycle through Pending, to In Progress, and Success. The command's results can be downloaded from the Output column.

Locally with the Edge Core API

Commands can be triggered locally without enrolling to Edge Manager by using the Edge Core API available at /var/run/edge-core/edge-core.sock. Once loaded, the command will be available at http://localhost/api/v1/host/commands/<handler>/<command>.

An example using curl:
curl --unix-socket /var/run/edge-core/edge-core.sock \
     http://localhost/api/v1/host/commands/host/date \
     -X POST
Example success response:
{"output": "Service predix-edge-broker removed."}
Example error response:
{ "error_message": "Not Found", "status_code": 404}
Note: The Edge Core API is not currently available on Ubuntu or Windows versions of Edge, as it is only required for use with the Predix Edge Technician Console (PETC).