LXD Rest API run command and get output

Hey,

Running commands via the API works fine.
But how can I get a result/output of the command I ran?

I played around with it, but never could get any output.

Thanks.

I’m not sure what you mean, can you provide some examples of what you are doing?

To put it simply, I want to run ls -l on a container and want to get that specific output.

However, I was not able to get a working example, where I can get the result as output.
Any idea or any example how this can be done?

You can either use the - exec api (enable recording the output & then get the output from the log)

Exec API
https://linuxcontainers.org/lxd/docs/master/rest-api#10instancesnameexec
Files API
https://linuxcontainers.org/lxd/docs/master/rest-api#10instancesnamelogslogfile

Or you can use the files api

https://linuxcontainers.org/lxd/docs/master/rest-api#10instancesnamefiles

Turns out, the reason why this is not working, was that THAT ONE FUCKING THING was RAW and not JSON. But why? EVERYTHING is JSON, unexpected

Rawwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww
Case closed.