https://api.sciener.com/v3/qrCode/add
Create a "QR code" in the cloud server, the response will contain a H5 page link displaying a QR code, put the QR code close to the camera of the lock, the lock will scan the QR code and identify the information in the QR code, hence unlock the lock.
If you don't want to use the default QR code link page, you can request cloud API: Get QR code data to get the content of QR code data, and generates the QR code image based on the content.
Locks that support custom QR codes can have QR codes added directly to them via an app, Bluetooth, or a gateway.
Note:
Only specific types of locks support QR code function. If the lock does not support QR code function, "The lock does not support this function" will be alerted. Specifically, it can be determined based on the lock's feature value; random QR code: 44th bit ; custom QR code: 108th bit .
POST, ContentType:application/x-www-form-urlencoded
xxxxxxxxxx91curl --location -g --request POST 'https://api.sciener.com/v3/qrCode/add' \2--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \3--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \4--data-urlencode 'lockId=163377' \5--data-urlencode 'name=QR code for alex' \6--data-urlencode 'type=1' \7--data-urlencode 'startDate=1625025703000' \8--data-urlencode 'endDate=1665025703000' \9--data-urlencode 'date=1625025703000'| 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, generated by Lock init |
| name | String | N | Qr code name |
| type | Int | Y | QR code type, 1-period, 2-permanent, 4-cyclic |
| startDate | Long | N | The time when it becomes valid (timestamp in millisecond) |
| endDate | Long | N | The time when it is expired (timestamp in millisecond) |
| refreshTime | Int | N | QR code refresh time, minutes per unit of time, default value is 10, maximum 1440 |
| cyclicConfig | JSONArray String | N | Recurring time period, the valid time period of each week day must be the same, for example: [{"weekDay":1, "startTime":480,"endTime":1080},{"weekDay":2, "startTime":480,"endTime":1080}] for valid from 8:00 to 18:00 in Monday and Tuesday. |
| addType | Int | Y | Adding method for random QR code: 0- Cloud method. If left blank, the default is 0. A QR code is generated from the cloud. The QR code is generated by the cloud's algorithm rules and can be generated without the lock being connected to a gateway. Adding methods for custom QR code: 1- Add via SDK Bluetooth. You must add via SDK Bluetooth first before calling this interface. 2- Add remotely via gateway or WiFi lock. Lock is a WiFi lock or connected to a gateway, you can go to option 2 and directly call this interface to add it to the lock. |
| qrCodeNumber | String | N | This parameter is required when adding a custom QR code: Custom QR codes added via APP Bluetooth or gateway require a QR code field. The QR code cannot be larger than 4294967295 and cannot be smaller than 65535. Developers must ensure the QR code number is unique. Recommendation: Developers can directly use a second-level timestamp. |
| date | Long | Y | Current time (timestamp in millisecond) |
cyclicConfig:
| Parameter | Type | Description |
|---|---|---|
| startTime | Int | The time when it becomes valid, in minute, for example 480 for 8:00 |
| endTime | Int | The time when it becomes validit is expired, in minute, for example 1080 for 18:00 |
| weekDay | Int | Week day:1-7, 1-Monday, 2-Tuesday...7-Sunday |
| Parameter | Type | Description |
|---|---|---|
| qrCodeId | Int | QR code id |
| qrCodeNumber | Int | QR code number: the unique number of QR code in a lock. It's will be contained in the unlocking records for identifing which code unlock the lock. |
| link | Int | The H5 page URL displaying QR code |
xxxxxxxxxx51{2"qrCodeId": 34242,3"qrCodeNumber": 1,4"link": "https://ttekey.com/q?k=Gc5Wg6Hh"5}