HTTP 401 Unauthorized with /lockState or /lockAction endpoints

Hi,
I am trying to reach the bridge over a curl request.
Some endpoints are working fine like the /info or /list no issue whatsoever.

The problem is when I try to call /lockState or /lockAction, no matter the authentication method (plain or hashed token) I always get the same result: HTTP 401 Unauthorized.

Bridge Firmware: 2.1.37
SmartLock Firmware: 2.4.5
Here is what I tried:
curl http://192.168.1.103:8080/lockState?nukiId=XXXXXX&token=XXXXX
or
curl http://192.168.1.103:8080/lockState?nukiId=XXXXXXX&ts=2019-03-14T16:17:11Z&rnr=4612&hash=XXXXXXXXXXXXXXXXXXXXXX

Is there anything specific with those two endpoints(/lockState & /lockAction) that must be done prior any call?
Do I have to change any settings in the smartLock in order to make this work?

Thanks a lot

There are only 2 differences between those endpoints:

  1. You need the Smart Lock ID for those which failed for you, so be sure you used the correct ID (dec value not hex)!

  2. With the second parameter I sometimes myself get 401 in the console when I forgot to set (single) quotes around the URL when calling from the command line. So be sure to use curl 'http://192.168.1.103:8080/lockState?nukiId=XXXXXX&token=XXXXX'

I hope one of these is a quick solution for you!

1 Like

Indeed, it was the single quotes.
It works fine now!
Thank you!

1 Like