diff --git a/Documentation/Reference/MaxCtrl.md b/Documentation/Reference/MaxCtrl.md index d5effed0d..4b602e466 100644 --- a/Documentation/Reference/MaxCtrl.md +++ b/Documentation/Reference/MaxCtrl.md @@ -32,6 +32,7 @@ For more information about the MaxScale REST API, refer to the * [rotate](#rotate) * [call](#call) * [cluster](#cluster) +* [api](#api) ## Options @@ -39,7 +40,9 @@ All command accept the following global options. ``` -u, --user Username to use [string] [default: "admin"] - -p, --password Password for the user [string] [default: "mariadb"] + -p, --password Password for the user. To input the password manually, give -p + as the last argument or use --password='' + [string] [default: "mariadb"] -h, --hosts List of MaxScale hosts. The hosts must be in HOST:PORT format and each value must be separated by a comma. [string] [default: "localhost:8989"] @@ -664,3 +667,21 @@ due to a network failure or some other ephemeral error. Any other errors require manual synchronization of the MaxScale configuration files and a restart of the failed Maxscale. +## api + +``` +Usage: api + +Commands: + get [path] Get raw JSON + +``` + +### api get + +`Usage: get [path]` + +Perform a raw REST API call. The path definition uses JavaScript syntax to +extract values. For example, the following command extracts all server states as +an array of JSON values: maxctrl api get servers data[].attributes.state + diff --git a/maxctrl/lib/api.js b/maxctrl/lib/api.js index 716924110..835e43057 100644 --- a/maxctrl/lib/api.js +++ b/maxctrl/lib/api.js @@ -19,7 +19,9 @@ exports.builder = function(yargs) { yargs .command('get [path]', 'Get raw JSON', function(yargs) { return yargs.epilog('Perform a raw REST API call. ' + - 'The path definition uses JavaScript syntax to extract values.') + 'The path definition uses JavaScript syntax to extract values. ' + + 'For example, the following command extracts all server states ' + + 'as an array of JSON values: maxctrl api get servers data[].attributes.state') .usage('Usage: get [path]') }, function(argv) { maxctrl(argv, function(host) {