How can I use this command POST /v2/snapctl?

I am trying to use this call using curl, but I don’t know what is the format to get the state of the services.

curl -X POST http://localhost/v2/snapctl
-H ‘Content-Type: application/json’
-d ‘{“context-id”: “lxd”, “args”: [ “services”, “lxd.activate” ]}’

I got this error
{“type”:“error”,“status-code”:403,“status”:“Forbidden”,“result”:{“message”:“access denied”,“kind”:“login-required”}}

but I want to get this response all commands are launched with sudo

Service Startup Current Notes
lxd.activate enabled inactive -

Hi, are you running this inside a snap or outside of a snap?

I am running Outside of the snap

If you are running outside of a snap you don’t need to use the snapctl endpoint you can use the normal snapd REST API, see for details

1 Like