Hello,
I'm trying to add a button on Hassio in order to shutdown OMV NAS using RPC calls instead of SSH commands.
My plan is to send 2 RPC calls: one for the login, and one for the system/shutdown command.
During the test I'm doing, the login call works good and generate a cookie but the system/shutdows call doesn't works and say that I'm not authenticated ...
From my PC terminal:
Code
$ curl --request POST --cookie-jar cookies.txt --data '{"service":"session","method":"login","params":{"username":"admin","password":"myRealPassword"}}' http://192.168.0.5/rpc.php
{"response":{"authenticated":true,"username":"admin"},"error":null}
$ curl --request POST --cookie-jar cookies.txt --data '{"service":"system","method":"shutdown","params":{"delay":"15"}}' http://192.168.0.5/rpc.php
{"response":null,"error":{"code":5000,"message":"Session not authenticated","trace":"OMV\\ErrorMsgException: Session not authenticated in \/usr\/share\/php\/openmediavault\/session.inc:146\nStack trace:\n#0 \/usr\/share\/php\/openmediavault\/rpc\/proxy\/json.inc(81): OMV\\Session->validateAuthentication()\n#1 \/var\/www\/openmediavault\/rpc.php(45): OMV\\Rpc\\Proxy\\Json->handle()\n#2 {main}"}
Other useful infos:
This is the first time in my life I use RPC calls so probably I'm missing something.
The OMV system is updated to today (version 4.1.22-1).
I have 2 user in my OMV installation: admin and another one. I tried with both without success.
Tried also without delay parameter.
Code
$ cat cookies.txt
# Netscape HTTP Cookie File
# https://curl.haxx.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
192.168.0.5 FALSE / FALSE 0 X-OPENMEDIAVAULT-SESSIONID 2------deleted-----------7
Thanks to those who want to help me.