This article will guide you through creating a smart card layout and configuring it to a device via BioStar 2 API.
1) Create a Smart Card Layout
2) Configure Smart Card Layout to a Device
STEP 1. Create a Smart Card Layout
POST /api/cards/layouts
This API is used to create a smart card layout.
Fill the corresponding parameter with the card's specification for the request body.
If the card uses default configuration, then simply fill the name parameter and run the API.
Body Parameters :
Parameter | Type | Required | Description |
---|---|---|---|
use_second_key | boolean | N | Use CardLayout Second Key |
mifare_primary_key | string | N | CardLayout Mifare Primary Key |
mifare_start_block_index | string | N | CardLayout Mifare Start Block Index |
iclass_start_block_index | string | N | CardLayout iClass Start Block Index |
desfire_app_id | integer | N | CardLayout Desfire App Id |
desfire_file_id | integer | N | CardLayout Desfire File Id |
desfire_encryption_type | integer | N | CardLayout Desfire Encryption Type 0 : DES/3DES 1: AES |
template_size | integer | N | CardLayout Template Size |
des_adv_app_master_key_index | string | N | CardLayout Des Adv App Master Key Index |
des_adv_file_read_access_key_index | string | N | CardLayout Des Adv File Read Access Key Index |
des_adv_file_write_access_key_index | string | N | CardLayout Des Adv File Write Access Key Index |
mifare_second_key | string | N | CardLayout Mifare Second Key |
iclass_primary_key | string | N | CardLayout iClass Primary Key |
iclass_second_key | string | N | CardLayout iClass Second Key |
desfire_primary_key | string | N | CardLayout Desfire Primary Key |
desfire_second_key | string | N | CardLayout Desfire Second Key |
seos_primary_key | string | N | CardLayout Seos Primary Key |
seos_second_key | string | N | CardLayout Seos Second Key |
seos_adf | string | N | CardLayout Seos Adf |
name | string | Y | CardLayout Name |
desfire_advanced_mode | integer | N | CardLayout Desfire Advanced Mode 0 : legacy (use picc master key) 1 : new mode (use app master, file read, file write key) |
Postman Request Example :
If successful, you'll receive a 200 response code and a response body with newly added Smart Card Layout information.
Find and keep "id" of the newly added smart card layout to be used in the next Step. This value will be used as parameter for when configuring the smart card layout to a device.
Postman Response Example :
You can verify that there's a new Smart Card Layout named "smart_test3" in BioStar 2 Web UI.
STEP 2. Configure a Smart Card Layout to a Device
POST /api/devices/:id
This API is used to update device's configuration. In this specific example, we'll only change the smart card layout configuration.
Path Variable :
Parameter | Description |
---|---|
id | Id of device to add the smart card layout |
Body Parameters :
Use "id" value obtained from Step 1.
Parameter | Type | Required | Description |
---|---|---|---|
card_layout:id | integer | Y | Id of smart card layout |
Postman Request Example :
If successful, you should get a 200 response code.
Post Response Example :
You can see that "smart_test3" Smart Card Layout has been configured for device in BioStar 2 Web UI.