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

{
  "cardId": 1234567,
  "lockId": 456789,
  "cardNumber": "1234567890123456",
  "cardName": "Office Card",
  "startDate": 1672689580361,
  "endDate": 1675281580361,
  "createDate": 1672689580361,
  "senderUsername": "John"
}

GET/api/v1/identity-card/list

List all identity cards

This endpoint allows you to retrieve a paginated list of all 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 (minimum 1)

  • Name
    pageSize
    Type
    integer
    Description

    Page size minimum 10, maximum 1000

Request

GET
/api/v1/identity-card/list
curl --location --request GET 'https://api.dusaw.com/api/v1/identity-card/list?lockId=456789&pageNo=1&pageSize=20' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {token}'

Response

{
  "list": [
    ...
    {
      "cardId": 1234567,
      "lockId": 456789,
      "cardNumber": "1234567890123456",
      "cardName": "Office Card",
      "startDate": 1672689580361,
      "endDate": 1675281580361,
      "createDate": 1672689580361,
      "senderUsername": "John"
    }
    ...
  ],
  "pageNo":1,
  "pageSize":10,
  "pages":3,
  "total":25
}

POST/api/v1/identity-card/add

Add identity card

This endpoint allows you to add a new identity card to a lock.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    cardNumber
    Type
    string
    Description

    The card number.

  • 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 a gateway.

  • Name
    method
    Type
    string
    Description

    How the card number is interpreted. regular - use the card number as provided. reverse - use the reversed card number.

  • Name
    startDate
    Type
    long
    Description

    The time when the card becomes valid (in milliseconds). Must be later than 6 hours ago.

Optional attributes

  • Name
    cardName
    Type
    string
    Description

    The card name.

  • Name
    endDate
    Type
    long
    Description

    The time when the card expires (in milliseconds). Must be greater than startDate.

Request

POST
/api/v1/identity-card/add
curl --location --request POST 'https://api.dusaw.com/api/v1/identity-card/add' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 456789,
    "cardNumber": "1234567890123456",
    "cardName": "Office Card",
    "addType": 2,
    "method": "regular",
    "startDate": 1672689580361,
    "endDate": 1675281580361
  }'

Response

{
  "cardId": 1234567
}

PUT/api/v1/identity-card/change-validity

Change identity card validity

This endpoint allows you to change the validity period of an identity card.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    cardId
    Type
    integer
    Description

    The 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 a gateway.

  • Name
    startDate
    Type
    long
    Description

    The time when the card becomes valid (in milliseconds). Must be later than 6 hours ago.

  • Name
    endDate
    Type
    long
    Description

    The time when the card expires (in milliseconds). Must be greater than startDate.

Request

PUT
/api/v1/identity-card/change-validity
curl --location --request PUT 'https://api.dusaw.com/api/v1/identity-card/change-validity' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 456789,
    "cardId": 1234567,
    "changeType": 2,
    "startDate": 1672689580361,
    "endDate": 1675281580361
  }'

Response

{
  "success": true
}

PUT/api/v1/identity-card/rename

Rename identity card

This endpoint allows you to rename an identity card.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    cardId
    Type
    integer
    Description

    The card ID.

  • Name
    cardName
    Type
    string
    Description

    The new 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 a gateway.

Request

PUT
/api/v1/identity-card/rename
curl --location --request PUT 'https://api.dusaw.com/api/v1/identity-card/rename' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer {token}' \
  --data-raw '{
    "lockId": 456789,
    "cardId": 1234567,
    "cardName": "Reception Card",
    "changeType": 2
  }'

Response

{
  "success": true
}

DELETE/api/v1/identity-card/delete

Delete identity card

This endpoint allows you to delete an identity card from a lock.

Required attributes

  • Name
    lockId
    Type
    integer
    Description

    The lock's unique identifier.

  • Name
    cardId
    Type
    integer
    Description

    The 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 a gateway.

Request

DELETE
/api/v1/identity-card/delete
curl --location --request DELETE 'https://api.dusaw.com/api/v1/identity-card/delete?lockId=456789&cardId=1234567&deleteType=2' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer {token}'

Response

{
  "success": true
}

Was this page helpful?