Tuesday, February 03, 2026

A handy ONTAP REST fallback: POST /api/private/cli with input

The /api/private/cli family is useful, but the “standard”/structured passthrough style (where the CLI maps onto /api/private/cli/<command-path> and parameters become fields/query params) only covers a subset of CLI commands and behaviours.

When that structured approach doesn’t work (or there’s simply no corresponding REST endpoint you can use), there’s a more free-form option: POST /api/private/cli with a JSON body containing an input string. In effect, you hand ONTAP a whole CLI command line to execute. The trade-off is that you typically get CLI-style text output back (not nice JSON records), but it can still be extremely handy for one-off automation and troubleshooting.

Example (raw CLI passthrough via input)
curl -u admin -k -X POST 'https://<cluster>/api/private/cli' \ -H 'accept: application/json' \ -H 'content-type: application/json' \ --data '{"input": "system node run -node * -command \"priv set diag; wafl scan speed\""}'

Enter host password for user 'admin':
{
  "output": "2 entries were acted on.\n\nNode: XXX-01\nWarning: These diagnostic commands are for use by NetApp\n         personnel only.\nWAFL scan speed is 1300\n\nNode: XXX-02\nWarning: These diagnostic commands are for use by NetApp\n         personnel only.\nWAFL scan speed is 1300\n\n"
}

btw: The CONTAP-458497 mentiones the input approach as well.

No comments: