Add a card into the lock, there are two methods to do it:
You can develop your own APP based on our APP SDK,call Add card method to add a card into the lock,then request cloud API: https://api.sciener.com/v3/identityCard/add ( with addType=1) to add it to the cloud to facilitate follow-up management.
If the lock is WiFi lock or it's connected to a gateway, you can add card remotely,just request cloud API: https://api.sciener.com/v3/identityCard/addForReversedCardNumber(with addType=2) , the gateway will add the card into the lock.
Notice: Card number of cards added by API:addForReversedCardNumber will change after added to the cloud, for example, request with cardNumber 3661413478,card number get from cloud API: Get all IC cards of a lock will be 1723612378, it's right,don't worry about it.
The same card, the card numbers read by card readers of different brands may be different because they are displayed in different byte order, big endian or little endian, so we've provided two APIs for adding card:
If cards added by cloud API: https://api.sciener.com/v3/identityCard/addForReversedCardNumber,with addType=2 can't unlock the lock, you can try cloud API:https://api.sciener.com/v3/identityCard/add,with addType=2.
You can list the added cards by cloud API: Get all IC cards of a lock.
POST, ContentType:application/x-www-form-urlencoded
xxxxxxxxxxcurl --location -g --request POST 'https://api.sciener.com/v3/identityCard/addForReversedCardNumber' \--data-urlencode 'clientId=4773aa036f7f49c68d876bb4be85c80c' \--data-urlencode 'accessToken=dfd5489d0cee31f0bdfaf59d0d42d71f' \--data-urlencode 'lockId=163377' \--data-urlencode 'cardNumber=3661413478' \--data-urlencode 'cardName=Card for mom' \--data-urlencode 'startDate=1625025703000' \--data-urlencode 'endDate=1645025703000' \--data-urlencode 'addType=2' \--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 |
| cardNumber | String | Y | Card number (1) card number returned by by APP SDK; (2) read from card reader. |
| cardName | String | N | Card name |
| startDate | Long | Y | The time when it becomes valid (timestamp in millisecond), when startDate and endDate all set to 0 it will be permanent. |
| endDate | Long | Y | The time when it is expired (timestamp in millisecond), when startDate and endDate all set to 0 it will be permanent. |
| cardType | Int | N | Card type:1-noraml card、4-cyclic(default value is 1) |
| cyclicConfig | JSONArray | 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 | Method: 1-via phone bluetooth,should call APP SDK method to add card first. 2-via gateway or WiFi lock,you can call this api directly if it's a WiFi lock or it's connected to gateway. The default value is 1. |
| date | Long | Y | Current time (timestamp in millisecond) |
Description of parameters in 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 |
|---|---|---|
| cardId | Int | Card ID |
xxxxxxxxxx{"cardId": 124242}