Send a Pincode to the Smartlock Pro

Hello,

I’m trying to set a pincode through the web api thanks to a WordPress plugin I’m developping.
I’ve checked Web API Example: Manage PIN-Codes for your Nuki Keypad and for testing use the swagger UI Swagger UI

curl -X 'PUT' \
  'https://api.nuki.io/smartlock/17XXXX32/auth' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer mARDhzj8XXXXD-U.5JWGN-wtoKQgalH8HaBS_iCyNguU' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "allowedFromDate": "2022-08-28T15:53:45.404Z",
  "allowedUntilDate": "2022-08-28T15:53:45.404Z",
  "allowedWeekDays": 127,
  "allowedFromTime": 0,
  "allowedUntilTime": 0,
  "accountUserId": 3XXXXX6,
  "remoteAllowed": true,
  "smartActionsEnabled": true,
  "type": 0,
  "code": 245678
}'

Is answering (I’ve modified token & accountUserId):

{
  "detailMessage": "The supplied value '245678' for parameter 'code' is not valid",
  "stackTrace": [],
  "suppressedExceptions": []
}

Could you please help me to solve this ?

Thank you

Hi Sébastian,

type = 0 is an App authorization.
If you want to create a Keypad authorization you need to change it to type = 13 (see Create a new Keypad PIN)

Alex

The problem is, it doesn’t work with 13.

curl -X 'PUT' \
  'https://api.nuki.io/smartlock/17XXXX32/auth' \
  -H 'accept: application/json' \
  -H 'authorization: Bearer DdfC-8JZTEmV70DAietzjQ_OQhHjB5XXXXXXXXXXX_abJhbmZyTtR3HUdfQ1dFSU' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "string",
  "allowedFromDate": "2022-08-29T14:54:39.551Z",
  "allowedUntilDate": "2022-08-29T14:54:39.551Z",
  "allowedWeekDays": 127,
  "allowedFromTime": 0,
  "allowedUntilTime": 0,
  "accountUserId": 0,
  "remoteAllowed": true,
  "smartActionsEnabled": true,
  "type": 13,
  "code": 256589
}'
{
  "detailMessage": "The supplied value '13' for parameter 'type' is not valid",
  "stackTrace": [],
  "suppressedExceptions": []
}

Did you make sure that a Keypad is paired with the Smart Lock?

For more details please send a direct message with your Smart Lock ID to me.