Control keypad (code) working time through API

Hi all,

I’m new to this forum :slight_smile:

First of all, sorry for my english :confused:

I’m using the Nuki Smart Lock 3.0

I’m wondering if there would be a way to control the codes access times with the Nuki API ?

I want to be able to send a webhook request using Zapier to the smartlock to update the code access times.

I’m not a dev but i usually make my way through what I need to do.
Unfortunately I took a look at the documentation and could not find anything close to what i’m looking to do.

I’ve seen this topic :

But I must confess, i’m confused on how to use those informations with Zapier.

Thank you very much for your help.

Bests,

Raoni

Hi Raoni,

You can use the PUT /smartlock/auth to update the code access times

{“name”: “Test”, “type”: 13, “code”: 999999, “allowedFromDate”: “2020-03-19T16:00:00.000Z”, “allowedUntilDate”: “2020-03-20T16:00:00.000Z”,“allowedWeekDays”: 0}

You can take a look at this thread here for more details

Let me know if this helps.

Hi @poonam.chavan,

Thank you for your fast answer !

I have been working on it today and I’ve been able to send GET requests from Zapier via webhooks.

I started with this POST request :

curl -X ‘GET’
https://api.nuki.io/smartlock/auth
-H ‘accept: application/json’
-H 'authorization: Bearer

Unfortunately I only get the informations from the “nuki web” user.

As you can see here :

The same comand in Swagger UI gives a diferent answer with all the user from all my smartlocks.

I dont understand why i can’t get all the datas from the request.

Thank you again for your help.

Bests,

Raoni

I think you used the GET command within the curl command. Could you please check?

Hi @poonam.chavan,

No, unfortunately, it’s a mistake I made on my message not in the command :confused:

This is how I have set my app on Zapier (it’s a GET request):

Should I had the Curl command in the Query String params ? I tried to do so but i get the same answer. Maybe i’m not filling it properly ?

Again, thank you for your help.

[EDIT]
When I use a precise PIN ID in the command url like :

https://api.nuki.io/smartlock/SMARTLOCK_ID/auth/PIN_ID

I do receive the expected response with all the informations from the PIN ID.

But when using :

https://api.nuki.io/smartlock/auth

To get a list of all the smartlock authorisations in only receive the nuki web.

I don’t get it… :frowning:

Hi all :wave:

I found the problem and the solution that goes with it !

Well… I didn’t found it alone, I’ve hopened a topic on the Zapier community and they solved it quicky !

For those who might be facing the same difficulties than me with Zapier, it appears that you need to send the request in a Javascript code step.

Here is the answer from GetUWired on Zapier Community:

There is a chance that Zapier would be engaging in a loop… which would be hard to tell in the set up. When you return an array of objects Zapier most commonly loops each remaining step (as is the case from a code block – though its not apparent that this will happen) or just returns the first object (as is the case for most search actions).
If you want greater control over what is returned, i’d suggest using a javascript code block and making a fetch request.

The solution is to creat a JavaScript code step instead of using webhooks by zapier.

You can find the whole topic and fetch request here

Thank you @poonam.chavan !

Hope it might help other Zapier users !

Thank you so much for sharing the solution here @Raoni_Moisan !

@Raoni_Moisan Hi, do you mind share your full zapier code?