Add QR code

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 .

 

1 Request example

POST, ContentType:application/x-www-form-urlencoded

2 Request parameters

NameTypeRequiredDescription
clientIdStringYclient_id from Create application
accessTokenStringYAccess token,refer to: Get access token
lockIdIntYLock ID, generated by Lock init
nameStringNQr code name
typeIntYQR code type, 1-period, 2-permanent, 4-cyclic
startDateLongNThe time when it becomes valid (timestamp in millisecond)
endDateLongNThe time when it is expired (timestamp in millisecond)
refreshTimeIntNQR code refresh time, minutes per unit of time, default value is 10, maximum 1440
cyclicConfigJSONArray StringNRecurring 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.
addTypeIntYAdding 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.
qrCodeNumberStringNThis 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.
dateLongYCurrent time (timestamp in millisecond)

cyclicConfig:

ParameterTypeDescription
startTimeIntThe time when it becomes valid, in minute, for example 480 for 8:00
endTimeIntThe time when it becomes validit is expired, in minute, for example 1080 for 18:00
weekDayIntWeek day:1-7, 1-Monday, 2-Tuesday...7-Sunday

3 Response and example

ParameterTypeDescription
qrCodeIdIntQR code id
qrCodeNumberIntQR 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.
linkIntThe H5 page URL displaying QR code