Skip to main content

Global flags

The apimetrics CLI global flags use the --rsh-* family. They apply to every command, whether built in or generated.

FlagDescription
-o, --rsh-output-format stringOutput format: auto, json, table, … (default auto)
-f, --rsh-filter stringFilter / project results using a shorthand query
-H, --rsh-header stringArrayAdd a custom header
-q, --rsh-query stringArrayAdd a custom query parameter
-p, --rsh-profile stringAPI auth profile (default default)
-s, --rsh-server stringOverride scheme://server:port for an API
-r, --rsh-rawOutput the query result raw rather than escaped
--rsh-no-paginateDisable auto-pagination
--rsh-no-cacheDisable the HTTP cache
--rsh-ignore-status-codeDo not set the exit code from the HTTP status code
--rsh-insecureDisable SSL verification
--rsh-ca-cert stringPath to a PEM-encoded CA cert
--rsh-client-cert stringPath to a PEM-encoded client certificate
--rsh-client-key stringPath to a PEM-encoded private key
--rsh-retry intNumber of times to retry on certain failures (default 2)
-t, --rsh-timeout durationTimeout for HTTP requests
-v, --rsh-verboseEnable verbose log output
--service-account stringAuthenticate with a service account file instead of a browser login. Env: APIMETRICS_SERVICE_ACCOUNT
--project-id stringUse this project for the run, overriding the selected project. Env: APIMETRICS_PROJECT_ID
--versionPrint the CLI version, OpenAPI spec version, and last spec check date
-h, --helpHelp for the command

JSON output is -o json, not --json​

There is no --json flag. To get machine-readable JSON, use the output-format flag:

# Correct
apimetrics list-monitors -o json

# Also valid (long form)
apimetrics list-monitors --rsh-output-format json

There is no api configure​

The CLI does not register an api configure command or the generic HTTP verb commands (get, post, …). To authenticate, use login instead of api configure. To call the API, use the generated per-operation commands.

Examples​

# Pretty table (default) vs. JSON
apimetrics list-monitors
apimetrics list-monitors -o json

# Add a custom header and override the server for one call
apimetrics list-monitors -H 'X-Trace: 1' -s https://staging.example.com

# Filter results client-side
apimetrics list-monitors -f 'body.data[].name'

Shell completion​

The completion command generates an autocompletion script for bash, zsh, fish, or powershell.

# Print the completion script for your shell
apimetrics completion zsh

Run apimetrics completion <shell> --help for instructions on loading the script in your shell.

See also​