Create Temporary Password

Last Updated on : 2024-08-19 06:20:49download

Create a temporary password for a smart lock.

API address

POST: /v1.0/devices/{device_id}/door-lock/temp-password

Request parameter

Parameter nameTypeINRequiredDescription
device_idStringuritrueThe device ID.

Description of body

Parameter nameTypeINRequiredDescription
nameString trueThe password name.
passwordString true
  • Indicates the length of the original password.
  • Wi-Fi lock: 7.
  • Zigbee or Bluetooth lock: 6.
  • Encryption algorithm: AES.
  • Mode: ECB mode and PKCS7Padding.
  • Data block: 128 bits.
  • Key: The original key. To get this key, decrypt the temporary key ticket_key with AES by using the accessKey that is issued by the platform.
  • The output is in the format of hex.
effective_timeLong trueThe 10-digit timestamp of the effective time.
invalid_timeLong trueThe 10-digit timestamp of the expiration time.
password_typeString truePassword encryption type: ticket.
phoneString falseThe mobile phone number.
typeInteger falseThe validity type of password. Valid values:
  • 1: A password can only be used once before it expires.
  • 0: A password can be used as many times as needed before it expires.
time_zoneString falseThe time zone. This field is required if you use the periodic password function.
ticket_idString trueThe ID of a specified temporary key.
schedule_listList falseThe information about periodic passwords.
relate_dev_listarray[Stirng] trueThe list of linked devices. The length is 1 and only Bluetooth lock accessories are supported.

Description of schedule_list

Parameter nameTypeINRequiredDescription
effective_timeLong trueThe start time. It is stored in minutes. For example, 07:30 indicates that the value is 450. Calculation: 7 x 60 + 30 = 450.
invalid_timeLong trueThe end time. It is stored in minutes. For example, 07:30 indicates that the value is 450. Calculation: 7 x 60 + 30 = 450.
working_dayInteger trueThe working days. One week is represented in one byte. bit0 to bit6 respectively represent Sunday to Saturday. 1 means valid, 0 means invalid, and the last digit is represented by 0. For example, Monday/Tuesday/Friday is represented as 00100110, which equals 38, so the value of working_day is 38.

Return parameter

Parameter nameTypeDescription
resultJSONObjectThe returned result.

Description of result

Parameter nameTypeDescription
idLongThe password ID.

Request example

POST: /v1.0/devices/vdevo15345926009****/door-lock/temp-password
{
  "password": "956FAD7****09C68E168B77",
  "password_type": "ticket",
  "ticket_id": "****",
  "effective_time": 1579156726,
  "invalid_time": 1579243126,
  "name": "test",
  "phone": 11233213,
  "time_zone": "",
  "schedule_list": [
    {
      "effective_time": 720,
      "invalid_time": 1080,
      "working_day": 0
    }
  ]
}

Return example

{
    "result": {
        "id": 124367346
    },
    "t": 1542626129429,
    "success": true
}

Error code

For more information, see error code.