"HTTP code 204" but code apparently not created

Hello,

Our solution sends requests to generate codes on smartlocks. It usually works correctly, but this month, a customer of ours (who pays a Nuki subscription) got two issues with his smartlocks (these specific smartlocks work usually).
We sent: PUT https://api.nuki.io/smartlock/{smartlockId}/auth, for instance at these datetimes:
2024-09-01 20:13:21 UTC
2024-09-02 21:03:23 UTC

In return, we received from Nuki a success HTTP code 204, but our customer could not find the codes, so he had to create them on Nuki’s user interface.

Do you know what happened as these codes seemed created with the requests but were apparently not?

Thank you,

Hello,

If you are not using webhooks:

The Nuki Web API is asynchronous. When you send a command, you will get an immediate OK response (i.e. 200, or in this case 204) which means that the request has succeeded, but that doesn’t guarantee that the client has executed the request successfully. Once the server has received the API call, it will try to reach the Smart Lock and create the code (all the codes are stored on the Smart Lock itself). This usually takes some seconds, and the device should be online.

Thus, call the GET /smartlock/auth endpoint within a few minutes to validate if the auth was created successfully.

The auths may not be created successfully if the devices were not online during this time.

If you are using webhooks:

A webhook is triggered when an authorization is created (also when it is modified or deleted).

Example webhook response:

AuthResponse {
“feature”: “DEVICE_AUTHS”,
“deleted”: false,
“smartlockAuth”: {
“id”: “65219648fe57075d71a6cb01”,
“smartlockId”: 11000009999,
“authId”: 1,
“code”: 982345,
“type”: 13,
“name”: “example”,

}
}

Thus, the best practice is to use webhooks to validate if auths are created successfully.

Thank you for your answer.

I guess our developer team did code the webhook part, but it may become different last year when Nuki API became paying. There is no webhook field in the advanced API tab for the customer who met the issue.

(Besides I can see the last log of webhook was on October 2023 for all our customers)
Do all our customers have to ask Nuki an access to this feature?

And, about the specific case (while the webhook part is being solved), is it possible to have an explanation about the codes not being created on the lock? It happens a lot. I can provide details by private if needed. It was for instance at 2024-09-09 18:13:21 for a code from 2024-09-12 to 2024-09-17.

Thank you,

Hi,
If it can help, I attach you the dev team’s Nuki interface with webhook field, and the screenshot of our customer’s interface where there is no webhook field.

Dev Team:

Customer:

Thank you,
Kind regards,

The advanced API is only activated/approved upon requesting it.

Especially for short rental purposes, it is only approved if there is a valid contract signed by the partner. In this case, the partner should request for advanced API access and not all the customers who are using the integration.

If you are a B2B customer, please reach out to b2b-support@nuki.io for more information about your situation.

For the case of codes not being created, please reach out to our customer support (contact@nuki.io) as these are specific to your devices and need further investigation. Thanks.

Thank you for the answer,

I will send an e-mail to b2b-support@nuki.io today.

For the codes not created specifically, I wrote to contact@nuki.io before posting the case here, they advised us to post on the forum as they couldn’t know why the code could not be created if it was API-related (which is the case).

Thank you,
Kind regards,

Thank you, looking forward to the details from our support team.

Thank you Poonam,

About the b2b-support@nuki.io, I exposed our situation but I just got this answer:

Thank you for your message.

Unfortunately, this is an external connection through the Nuki app, and we are unable to provide support for this issue.
Please ensure that the Smart Lock is online and that the Nuki Smart Hosting Service is activated for the Smart Lock.

Please apologize for any inconvenience this may have caused.

If you have any further questions, we will be happy to help you.

(My message was:

We are L***, a company developing a channel manager called A***.

Some years ago, we developped a plugin in A*** so our customers could integrate Nuki, with Nuki API.
After some issues and investigations, it appeared that since one year, the solution has not been working correctly anymore due to webhooks that are not available for everyone (and the status of an “auth” call to generate a code is not meaningful as the creation is asynchronous). The codes are still being created correctly most of the time, but sometimes, an error occurs and without the webhook endpoint, we can not know why (and even simply that an error occurred)…

Could you tell us how to proceed so we could solve this process issue?

Thank you a lot,
Kind regards,

)

I’m not sure how to solve this and if it’s even possible…

Thank you,

Please check your DM as I would need more details to look into this further.