Runs a node console command passed in the request — almost any that pmta understands.
The call is POST /command with the form fields command — the command text without the word pmta — and format. The response format is json or xml with a structure, or json-text and xml-text: console text wrapped in a document.
The exceptions are named in the manual: register, deregister and interactive commands such as resolve –interactive cannot be run this way.
🔴 This is a full console over the network: message deletion, queue mode changes and configuration reloads all go through here. The manual authorizes the request with the key from http-api-key in the X-API-Key header, and the key grants full access from any address — keep it like an administrator password.
And a second one, noticed by the Hub on a live engine: json-text returns an empty string for some commands where json returns a structure.
Over SSH only stopping, starting and restarting the service go; applying the configuration — writing files, checking and reloading — also goes over SSH.
Which format to take:
| format | What arrives | When |
|---|---|---|
| json | a structure in data | for a program — this is how the Hub reads it |
| xml | a structure in XML | for a program that prefers XML |
| json-text | console text as a string in data | to show a person as is |
| xml-text | console text in XML | the same for XML |
# a console command over the network: the key from http-api-key curl -s -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/command' -F command='show version' -F format=json
4 relations
curl -s -H 'X-API-Key: KEY' 'http://127.0.0.1:8080/command' -F command='show version' -F format=json grep -n 'http-api-key' /etc/pmta/config
3 articles
◇What the node tells about itself and through which channelsSeven observation surfaces: the web monitor, the console in four formats, the log, accounting, accounting search, metrics and export to external analytics.◇Two inbound report processors and what to do with themBounces by message and complaints are parsed by two identically structured blocks; each has its own address list and its own pair of decisions about the message’s fate.◇Five ways for a queue to hand off a messageA queue does not have to use SMTP: it can write to a file, run a program, call over HTTP or discard.