Change the period of validity of a card
https://cnapi.sciener.com/v3/identityCard/changePeriod
Change the period of validity of fingerprint , there are two methods to do it:
(1)Change by APP nearby the lock via bluetooth:
You can develop your own APP based on our APP SDK,call Modify a card's validity method to change it in the lock, then request this API ( with changeType=1) to sync it to cloud.
(2)Change by cloud API via gateway or WiFi lock:
If the lock is WiFi lock or it's connected to a gateway, you can change it remotely,just request this API ( with changeType=2) .
1 Request example
javascript
curl --location -g --request POST 'https://cnapi.sciener.com/v3/identityCard/changePeriod' \
--data-urlencode 'clientId=fd2ff35ee3xxxxxx' \
--data-urlencode 'accessToken=780f7671b6e6bxxxxxxx' \
--data-urlencode 'lockId=24451' \
--data-urlencode 'cardId=124242' \
--data-urlencode 'startDate=1626945087000' \
--data-urlencode 'endDate=1846945087000' \
--data-urlencode 'changeType=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, generated by Lock init |
| cardId | Int | Y | Card ID,get from Cloud API: Add card |
| startDate | Long | Y | The time when it becomes valid (timestamp in millisecond), you can't change it to permanent |
| endDate | Long | Y | The time when it is expired (timestamp in millisecond), you can't change it to permanent |
| 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. |
| changeType | Int | Y | Method: 1-via phone bluetooth, you should call APP SDK method 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 |
3 Response and example
| Parameter | Type | Description |
|---|---|---|
| errcode | Int | Error code |
| errmsg | String | Error message |
{
"errcode": 0,
"errmsg": "none error message"
}