Problem when repeatedly updating the same keypad smartlock authorization

Hello,

I stumbled upon an unexpected behavior when trying to repeatedly update a keypad smartlock authorization.

When trying to repeatedly set the code by calling [POST]/smartlock/{smartlockId}/auth/{id} with body {“code”: 555551} incrementing the code number by 1 each time, I normally get a 204 response code, but at some point, let’s say for {“code”: 555555} I get a 423 response code with body {“stackTrace”: [], “suppressedExceptions”: []}.

The unexpected behavior is that while I receive a 204 response code for the all the previous code update attempts (555551, 555552, 555553, 555554) when I’m trying to get the list of smartlock authorizations ([GET]/smartlock/{smartlockId}/auth) the code of the authorization finally registered is not the last one expected (555554) but its previous (555553).

In short, I am expecting 555554 to be set as it is returning a 204 but instead it is not set. I am expecting to get a 423 or the code to be set.

This behavior is reproducible using the Swagger interface, the firmware version for the bridge is 1.11.4, for the smartlock is 2.3.11 and for the keypad is 1.2.4

Thanks in advance for your insight!

Creating or updating keypad authorizations are asynchronous requests. Because the authorization is stored on the smartlock and api is more or less a read only cache. So a 204 response means that your api call has correct values and is queued to be transferred to the smartlock.
As long the operation is running further modifications on the same authorizations are locked. If you query the authorization you can check the existance of the operationId.

On api side their is currently no easy way to check if the command was successful. In the future their may be support for webhooks.

Hello,

is it possible that the same logic with locked operations applies on lock/unlock operation? I received 423 error status code on POST https://api.nuki.io/smartlock/<id>/action a couple of times already.
I haven’t found any mention of this error except for this thread and I’d like to understand more what is going on inside of the Nuki app.

Thanks in advance!

Hi,

Updates on smartlock authorizations or actions are done asynchronously. You can’t change the same authorization or send another action while their is aloready an operation for that specific item running.

In this cases you get error 423 (Locked).

cheers,
gernot