Passcodes

Passcodes are used to access a given lock. On this page, we'll dive into the different passcode endpoints you can use to manage passcodes programmatically.

The passcode model

The passcode model contains all the information about the passcodes.

Properties

  • Name
    keyboardPwdId
    Type
    integer
    Description

    The id of the passcode.

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    keyboardPwd
    Type
    string
    Description

    Passcode value

  • Name
    keyboardPwdName
    Type
    string
    Description

    Passcode name

  • Name
    keyboardPwdType
    Type
    integer
    Description

    Passcode type

  • Name
    startDate
    Type
    long
    Description

    The time when the passcode becomes valid (in milliseconds)

  • Name
    endDate
    Type
    long
    Description

    The time when the passcode expires (in milliseconds)

  • Name
    sendDate
    Type
    long
    Description

    Init time (in milliseconds)

  • Name
    isCustom
    Type
    integer
    Description

    Whether the passcode is custom or random

  • Name
    senderUsername
    Type
    String
    Description

    The username of the user who created the passcode

  • Name
    createDate
    Type
    long
    Description

    Creation time (in milliseconds)

  • Name
    effectiveDate
    Type
    long
    Description

    Effective time (in milliseconds)

  • Name
    expiryDate
    Type
    long
    Description

    Expiry time (in milliseconds)

  • Name
    enable
    Type
    boolean
    Description

    Whether the passcode is enabled

Passcode Object

{
  "keyboardPwdId": 12345,
  "lockId": 865759,
  "keyboardPwd": "123456",
  "keyboardPwdName": "Front Door",
  "keyboardPwdType": 1,
  "startDate": 1672689580361,
  "endDate": 1675281580361,
  "sendDate": 1672689580361,
  "isCustom": 1,
  "senderUsername": "John",
  "createDate": 1672689580361,
  "effectiveDate": 1672689580361,
  "expiryDate": 1675281580361,
  "enable": true
}

GET/api/v1/keyboard/list

List all passcodes

This endpoint allows you to retrieve a paginated list of all passcodes for a specific lock.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    pageNo
    Type
    integer
    Description

    Page number

  • Name
    pageSize
    Type
    integer
    Description

    Page size minimum 10, maximum 1000

Request

GET
/api/v1/keyboard/list
curl --location --request GET 'https://api.dusaw.com/api/v1/keyboard/list?lockId=865759&pageNo=1&pageSize=20' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {token}'

Response

{
  "list": [
    ...
    {
      "keyboardPwdId": 12345,
      "lockId": 865759,
      "keyboardPwd": "123456",
      "keyboardPwdName": "Front Door",
      "keyboardPwdType": 1,
      "startDate": 1672689580361,
      "endDate": 1675281580361,
      "sendDate": 1672689580361,
      "isCustom": 1,
      "senderUsername": "John",
      "createDate": 1672689580361,
      "effectiveDate": 1672689580361,
      "expiryDate": 1675281580361,
      "enable": true
    }
    ...
  ],
  "pageNo":1,
  "pageSize":10,
  "pages":3,
  "total":25
}

POST/api/v1/keyboard/add

Add passcode

This endpoint allows you to add a new passcode to a lock.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    keyboardPwd
    Type
    string
    Description

    Passcode value (4-9 digits)

  • Name
    keyboardPwdName
    Type
    string
    Description

    Passcode name

  • Name
    startDate
    Type
    long
    Description

    The time when the passcode becomes valid (in milliseconds)

  • Name
    endDate
    Type
    long
    Description

    The time when the passcode expires (in milliseconds)

Request

POST
/api/v1/keyboard/add
curl --location --request POST 'https://api.dusaw.com/api/v1/keyboard/add' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 865759,
    "keyboardPwd": "123456",
    "keyboardPwdName": "Front Door",
    "startDate": 1672689580361,
    "endDate": 1675281580361
  }'

Response

{
  "keyboardPwdId": 12345,
  "keyboardPwd": "123456"
}

POST/api/v1/keyboard/delete

Delete passcode

This endpoint allows you to delete a passcode from a lock.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    keyboardPwdId
    Type
    integer
    Description

    The passcode ID.

Request

POST
/api/v1/keyboard/delete
curl --location --request POST 'https://api.dusaw.com/api/v1/keyboard/delete' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 865759,
    "keyboardPwdId": 12345
  }'

Response

{
  "success": true
}

POST/api/v1/keyboard/change

Change passcode

This endpoint allows you to change an existing passcode.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    keyboardPwdId
    Type
    integer
    Description

    The passcode ID.

  • Name
    newKeyboardPwd
    Type
    string
    Description

    New passcode value (4-9 digits)

Request

POST
/api/v1/keyboard/change
curl --location --request POST 'https://api.dusaw.com/api/v1/keyboard/change' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 865759,
    "keyboardPwdId": 12345,
    "newKeyboardPwd": "654321"
  }'

Response

{
  "success": true
}

Was this page helpful?