POST /v1/restart Application API not working (balena Cannot read property 'services' of undefined)

I am trying to restart the application using the API. Reboot works fine, restart does not. I am using the Essentials version of the application and can only figure this only works on a multicontainer, but not sure why that would be the case. Any help work be appreciated.

I have to use the old RESIN version below because I am running an unsupported device and the older version works better.

curl -X POST --header “Content-Type:application/json” --data ‘{“appId”: 1234567}’ “$RESIN_SUPERVISOR_ADDRESS/v1/reboot?apikey=$RESIN_SUPERVISOR_API_KEY”

Hi @rpelletier,
I would first like to clarify whether you are trying to do so from inside the container of your device, by pointing to the supervisor API, or you want to achieve this by running a curl against the balena-cloud API to trigger a remote restart of the device (just like pressing the restart button on the dashboard would do).
What’s the response of the above command that you mentioned?

If you are trying to do so from within a container of a device, can you confirm that $RESIN_SUPERVISOR_API_KEY & $RESIN_SUPERVISOR_ADDRESS hold some sensible values inside the container?
What version of the OS and the supervisor are you using?
Running:

curl -X POST --header "Content-Type:application/json" \
	"$RESIN_SUPERVISOR_ADDRESS/v1/reboot?apikey=$RESIN_SUPERVISOR_API_KEY"

curl -X POST --header "Content-Type:application/json" \
	--data '{"appId": 123456}' \
	"$RESIN_SUPERVISOR_ADDRESS/v1/restart?apikey=$RESIN_SUPERVISOR_API_KEY"

did work on my case on a v2.12.7 device, but keep in mind that you might also have to apt-get update && apt-get install curl first.

Kind regards,
Thodoris

I am running it from within the container.
$RESIN_SUPERVISOR_API_KEY & $RESIN_SUPERVISOR_ADDRES both hold the information expected.
curl is installed.

Host OS Version
Resin OS 2.13.6+rev2

Supervisor Version
7.14.0

When I run the command I get “Cannot read property ‘services’ of undefine”

@thgreasi
After you confirmed for me that mys syntax was correct I went back and double-checked everything. It turns out I was simply confused about what my actual appID was. :frowning:

Thank you for pointing me in the right direction. This is confirmed working now. I appreciate your time.