HOME Forums Gateways Raspberry Pi REST HowTo? Reply To: REST HowTo?

Post count: 22

At the risk of resurrecting a dead thread…

I am attempting to use the REST API on my gateway. The documentation on the authenticate method seems light, but I think I understand that in order to authenticate, you would send a POST message with the hash of the password.

this seems like the appropriate syntax to me, looking at examples of other POST examples in the API docs:

curl http://MyServer:MySocket/system/authenticate -d”Password=MyHashValue” -XPOST

this command connects but yields a Not Authenticated message

{ "Password" : "d13a9c616a3f2772e2aa406d7ecc9470dd2dc605", "action" : "post", "args" : null, "error" : "Not authenticated", "id" : 0, "objs" : [ "system", "authenticate" ], "session_id" : "" }

The log file shows that the session is initiated and the the parameter is getting parsed

ZBPServer[23867]: Incoming connection.
ZBPServer[23867]: http_parser:: POST /system/authenticate/
ZBPServer[23867]: http:: param: Password value:d13a9c616a3f2772e2aa406d7ecc9470dd2dc605

but then the session ends
ZBPServer[23867]: Scheduler:: socket removed

So, how to debug this further..
is Password the correct parameter name? the exact same results occur if I change the parameter name to any random string

the docs say that the password should be the SHA1 hash value. I tried using shasum to create the hash, as well as using the actual hash value in the config.ini file, and just for grins using clear text.

are other parameters expected in addition to password? Not sure why the return says Args:null..

thanks for any pointers. this seems like a simple thing to start with.