Identity Cards
Identity Cards are used to access a given lock. On this page, we’ll dive into the different Identity Card endpoints you can use to manage them programmatically.
The identity Card model
The Identity Card model contains all the information about them.
Properties
- Name
cardId
- Type
- integer
- Description
The ID of the Identity Card.
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
cardNumber
- Type
- string
- Description
The card number.
- Name
cardName
- Type
- string
- Description
The card name.
- Name
startDate
- Type
- long
- Description
The time when the card becomes valid (in milliseconds)
- Name
endDate
- Type
- long
- Description
The time when the card expires (in milliseconds)
- Name
createDate
- Type
- long
- Description
Init time (in milliseconds)
- Name
senderUsername
- Type
- String
- Description
The username of the user who created the identity Card
Identity Card Object
{
"keyboardPwdId": 1234567,
"lockId": 456789,
"keyboardPwd": "123456",
"keyboardPwdName":"Identity Card for John",
"keyboardPwdType": "3",
"startDate": 1528848944000,
"endDate": 1628875944000,
"sendDate": 1528871944000,
"senderUsername": "user@google.com"
}
List all identity Cards
This endpoint allows you to retrieve a paginated list of all your Identity Cards for a specific lock.
Required attributes
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
pageNo
- Type
- integer
- Description
Page number
- Name
pageSize
- Type
- integer
- Description
Page size minimum 10, maximum 1000
Request
curl --location --request GET 'https://api.dusaw.com/api/v1/identity-card/list?lockId=7354852&pageNo=1&pageSize=20' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Response
{
"list": [
...
{
"cardId": 123262,
"lockId": 174477,
"cardNumber": "1325672378",
"cardName":"Card for dad",
"startDate": 1672777651378,
"endDate": 1672777651378,
"createDate": 1672777651378,
"senderUsername": "user@google.com"
},
...
],
"pageNo": 1,
"pageSize": 20,
"pages": 1,
"total": 5
}
Add a custom identity Card
The same card when read by different model / brand readers might give different results because they might use different byte layouts. That's why we have two methods to add a card to a lock: regular
and reverse
.
Card numbers of cards added with reverse method will look different after being added to the server, this is expected behaviour.
If after adding a card to a lock you can't unlock it, try adding it again with the other method.
Adds an Identity Card for a given lock.
Required attributes
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
cardNumber
- Type
- string
- Description
The card number.
- Name
method
- Type
- string
- Description
regular
orreverse
- Name
addType
- Type
- integer
- Description
1
- via phone bluetooth,should add through the app 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.
- Name
startDate
- Type
- long
- Description
The time when the card becomes valid (in milliseconds)
- Name
endDate
- Type
- long
- Description
The time when the card expires (in milliseconds)
Optional attributes
- Name
cardName
- Type
- String
- Description
The card name.
Request
curl --location --request POST 'https://api.dusaw.com/api/v1/identity-card/add?lockId=7116676&cardNumber=3661413478&method=regular&addType=1&startDate=1672778350900&endDate=1674778350900' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Response
{
"keyboardPwdId": 29828168
}
Change an Identity Card's Validity Period
You can modify the validity period of an Identity Card.
Required attributes
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
cardId
- Type
- integer
- Description
Identity Card ID
- Name
changeType
- Type
- integer
- Description
1
- via phone bluetooth,should change through the app 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.
- Name
startDate
- Type
- long
- Description
The time when the identity Card becomes valid (in milliseconds)
- Name
endDate
- Type
- long
- Description
The time when the identity Card expires (in milliseconds)
Request
curl --location --request PUT 'https://api.dusaw.com/api/v1/identity-card/change-validity?lockId=7116676&cardId=29828168&changeType=1&startDate=1672778826394&endDate=1675370826394' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Response
{
"success": true
}
Rename an Identity Card
You can rename an Identity Card.
Required attributes
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
cardId
- Type
- integer
- Description
Identity Card ID
- Name
cardName
- Type
- string
- Description
The card name.
- Name
changeType
- Type
- integer
- Description
1
- via phone bluetooth,should change through the app 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.
Request
curl --location --request PUT 'https://api.dusaw.com/api/v1/identity-card/rename?lockId=7116676&cardId=29828168&changeType=1&cardName=John'\''s card' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Response
{
"success": true
}
Delete a identity Card
This Endpoint deletes the card from the lock.
Required attributes
- Name
lockId
- Type
- integer
- Description
The lock's unique identifier.
- Name
cardId
- Type
- integer
- Description
Identity Card ID
- Name
deleteType
- Type
- integer
- Description
1
- via phone bluetooth,should delete through the app 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.
Request
curl --location --request DELETE 'https://api.dusaw.com/api/v1/identity-card/delete?lockId=7116676&cardId=29828168&deleteType=1' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {token}'
Response
{
"success": true
}