Community

Subscribe
Highlighted

get a cli output via api

Is there a way that I can get a cli output via api, rather than get a xml file and I have to parse it?

for example, I need following snap list output,

> snap list vol0

Volume vol0

working...

  %/used       %/total  date          name

----------  ----------  ------------  --------

  1% ( 1%)    0% ( 0%)  Jan 22 12:00  hourly.0

  2% ( 1%)    0% ( 0%)  Jan 22 08:00  hourly.1

  4% ( 2%)    0% ( 0%)  Jan 22 00:01  nightly.0

  5% ( 1%)    0% ( 0%)  Jan 21 20:00  hourly.2

  6% ( 1%)    0% ( 0%)  Jan 21 16:00  hourly.3

  7% ( 1%)    0% ( 0%)  Jan 21 12:01  hourly.4

  9% ( 1%)    0% ( 0%)  Jan 21 08:01  hourly.5

10% ( 2%)    0% ( 0%)  Jan 21 00:01  nightly.1

is that doable?

Re: get a cli output via api

Just run the command via ssh/rsh. The whole point of using API is to avoid parsing command output. You get exactly the same information via API calls but in more reliable and “computer-friendly” way.

Re: get a cli output via api

agreed