Set allow opening the privacy lock
https://cnapi.sciener.com/v3/lock/setOpenPrivacyLock
Set the "allow opening the privacy lock" attribute for an unlock method (IC card, keypad password). It is disabled (0) by default.
Setting method (setType):
- APP Bluetooth method: only updates the cloud record. The setting must first be completed on the lock side via APP/SDK Bluetooth before calling this API.
- Gateway method: if the lock is connected to a gateway or is a WiFi lock, the command will be issued remotely to the lock, and the cloud will save it only after the issuance succeeds.
The gateway method can only be used when the lock firmware supports unlock method user attributes (feature value support); otherwise, error code -4043 is returned.
1 HTTP request method and example
POST, ContentType:application/x-www-form-urlencoded
javascript
curl --location -g --request POST 'https://cnapi.sciener.com/v3/lock/setOpenPrivacyLock' \
--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \
--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \
--data-urlencode 'lockId=3001' \
--data-urlencode 'openType=6' \
--data-urlencode 'openTypeId=123456' \
--data-urlencode 'openPrivacyLock=1' \
--data-urlencode 'setType=2' \
--data-urlencode 'date=1626945087000'2 Request parameters
| Name | Type | Required | Description |
|---|---|---|---|
| clientId | String | Y | client_id from Create application |
| accessToken | String | Y | Access token,refer to: Get access token |
| lockId | Int | Y | Lock ID |
| openType | Int | Y | Unlock method type: 2-IC card, 6-keypad password |
| openTypeId | Int | Y | Unlock method ID: when openType=6, it is the keyboardPwdId returned by the Passcode list API; when openType=2, it is the cardId returned by the IC card list API |
| openPrivacyLock | Int | Y | Allow opening the privacy lock: 1-allowed, 0-not allowed (disabled) |
| setType | Int | Y | Setting method: 1-APP Bluetooth (only updates the cloud record; the lock-side setting must first be completed via APP/SDK Bluetooth), 2-gateway (issued remotely to the lock; can be called directly for WiFi locks or locks already connected to a gateway) |
| date | Long | Y | Current time (timestamp in millisecond) |
3 Response and example
| Parameter | Type | Description |
|---|---|---|
| errcode | Int | Error code |
| errmsg | String | Error message |
| description | String | Error description |
{
"errcode": 0,
"errmsg": "none error message",
"description":"表示成功或是"
}