Execute api to run remote commands for containers is not working

I am trying to execute remote commands into a container, using Rancher API. I run the following command, and the outcome is a token id and a web socket url. The commands pass via array don’t work. I’ve tried using /bin/sh without success . Could anyone help me with that ?

Command :
curl -u “${CATTLE_ACCESS_KEY}:${CATTLE_SECRET_KEY}” -X POST -H ‘Accept: application/json’ -H ‘Content-Type: application/json’ -d ‘{“attachStdin”:false, “attachStdout”:false, “command”:[“service”, “apache-perl”, “stop”], “tty”:false}’ “$RANCHER_URL/v1/projects/1a5/containers/1i156/?action=execute”

Output:
{“id”:null,“type”:“hostAccess”,“links”:{},“actions”:{},“token”:"eyJhbGc…XXX,“url”:“ws://rancher:8080/v1/exec/”}

The action just gives you back a URL and a signed token, which contains the command. You have to open a websocket connection to that url to actually execute the command, and send the token either as a Authorization: Bearer <token> header or added on to the URL as a ?token=<token> query param.

Thanks vicent ! I’ve got it, so i’ll use websocket if there are not another way, regards .