Generate Offline Temporary Password

Last Updated on : 2023-12-07 03:33:56download

This topic describes the APIs of Generate Offline Temporary Password.

API description

Generate an offline temporary password.

API address

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

Request parameter

Parameter name Type IN Required Description
device_id String uri true The device ID.
offline_pwd_add_request OfflinePwdAddRequest body true The information about an offline password.

Description of offline_pwd_add_request

Parameter name Type IN Required Description
effective_time Long false The time when the password takes effect. Unit: seconds. 1. Required for MULTIPLE(0). 2. ONCE(1)/CLEAR_ALL(9). Take the hour value of the current time. For example, the current time is 2021-01-23 22:11:12, then the value of this field is 2021-01-23 22:00:00. 3. MULTIPLE(0)/CLEAR_ONE(8). Take the hour value of the current time. For example, if the time passed in is 2021-01-27 15:11:12, the value of this field is 2021-01-27 15:00:00.
invalid_time Long false The time when the password expires. Unit: seconds. 1. Required for MULTIPLE(0). 2. ONCE(1). The value is the sum of the hour value of the current time plus 6 hours. For example,if the current time is 2021-01-23 22:11:12, the value of this field is 2021-01-24 04:00:00. 3. CLEAR_ALL(9). The value is the sum of the hour value of the current time plus 24 hours. For example, if the current time is 2021-01-23 22:11:12, the value of this field is 2021-01-24 22:00:00. 4. MULTIPLE(0)/CLEAR_ONE(8). Take the hour value of the current time if this field is not empty. For example, if the time passed in is 2021-01-27 15:11:12, the value of this field is 2021-01-27 15:00:00.
name String false The password name.
type String false The type of password.
  • multiple: an offline password that can be used for multiple times.
  • once: an offline password that can be used only once.
  • clear_one: clear an offline password.
  • clear_all: clear all offline passwords.
password_id String false The password ID. This value is required when the type is clear_one.

Return parameter

Parameter name Type Description
result OfflinePwdAddResponse The result of generating an offline temporary password.

Description of result

Parameter name Type Description
offline_temp_password_id String The password ID.
offline_temp_password String The password content.
offline_temp_password_name String The password name.
effective_time Long The time when the password takes effect. Unit: seconds.
invalid_time Long The time when the password expires. Unit: seconds.

Request example

POST: /v1.1/devices/6cdb36b2e489885fa57lzm/door-lock/offline-temp-password

Return example

{ "result": { "effective_time": 1623747600, "offline_temp_password_id": "2345011", "offline_temp_password": "0282554135", "invalid_time": 1623769200, "offline_temp_password_name": "name267" }, "t": 1623748396631, "success": true }

Error code

See Error code.