Instructions for recurring, one-time and permanent ekeys
The cloud API Send ekey: https://cnapi.ttlock.com/v3/key/send is also for sending recurring, one-time and permanent ekey.
When sending one-time ekey, you should request with parameter endDate = 1, other parameters are the same as timed ekey,after unlocking once with the one-time ekey, you should delete the ekey from your APP and call Delete ekey API to delete the ekey from the cloud;
When sending permanent ekey, request with startDate=0, endDate=0, other parameters are the same as timed ekey;
When sending recurring ekey, startDate and endDate parameters are different from the timed ekey,and there are another four parameters: keyType, weekDays, startDay, endDay. When change period of a recurring ekey, another three parameters: weekDays, startDay, endDay should be present. You have to decide if the recurring ekey is valid in your APP.
1 Request parameters for sending recurring ekey
| 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 |
| receiverUsername | String | Y | The receiver's username |
| keyName | String | Y | Key name |
| startDate | Long | Y | The time when it becomes valid (timestamp in millisecond),timestamp at the time of current day,for example, if you want the ekey to be valid from 9:00 of each day, then request with timestamp at 9:00 of current day. |
| endDate | Long | Y | The time when it is expired (timestamp in millisecond),timestamp at the time of current day,for example, if you want the ekey to be expired at 18:00 of each day, then request with timestamp at 18:00 of current day. |
| remarks | String | N | Comment |
| emoteEnable | Int | N | Is remote unlock enabled: 1-yes, 2-no |
| keyRight | Int | N | Is an authorized ekey: 1-yes, 0-no,the default value is 0 |
| createUser | Int | N | Auto create TTLock account if receiverUsername is not a registered TTLock account: 1-yes, 2-no (default), this parameter take effect only when receiverUsername is a mobile number or email, the created account's password is the last six characters of the username. |
| keyType | Int | N | Key type:4-recurring ekey |
| weekDays | JsonArray[Int] | N | The week days when the ekey is valid,for example:[1,2,3], for Sunday, Monday and Wednesday, alert: 1 is for Sunday, not Monday. |
| startDay | Long | N | The Day when it becomes valid (timestamp in millisecond),timestamp at 00:00:00 of the day. |
| endDay | Long | N | The Day when it is expired (timestamp in millisecond),timestamp at 23:59:59 of the day. |
| date | Long | Y | Current time (timestamp in millisecond) |
2 Extra response parameters for ekey related APIs
These three APIs: Get the eKey list of an account, Get one ekey, Get ekeys of a lock will response with following extra parameters for recurring ekey:
| Name | Type | Description |
|---|---|---|
| keyType | Int | Key type:4-recurring ekey |
| weekDays | JsonArray[Int] | The week days when the ekey is valid,for example:[1,2,3], for Sunday, Monday and Wednesday, alert: 1 is for Sunday, not Monday. |
| startDay | Long | The Day when it becomes valid (timestamp in millisecond),timestamp at 00:00:00 of the day. |
| endDay | Long | The Day when it is expired (timestamp in millisecond),timestamp at 23:59:59 of the day. |
