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 : 


ParameterTypeRequiredDescription
use_second_keybooleanNUse CardLayout Second Key
mifare_primary_keystringNCardLayout Mifare Primary Key
mifare_start_block_indexstringNCardLayout Mifare Start Block Index
iclass_start_block_indexstringNCardLayout iClass Start Block Index
desfire_app_idintegerNCardLayout Desfire App Id
desfire_file_idintegerNCardLayout Desfire File Id
desfire_encryption_typeintegerNCardLayout Desfire Encryption Type
0 : DES/3DES
1: AES
template_sizeintegerNCardLayout Template Size
des_adv_app_master_key_indexstringNCardLayout Des Adv App Master Key Index
des_adv_file_read_access_key_indexstringNCardLayout Des Adv File Read Access Key Index
des_adv_file_write_access_key_indexstringNCardLayout Des Adv File Write Access Key Index
mifare_second_keystringNCardLayout Mifare Second Key
iclass_primary_keystringNCardLayout iClass Primary Key
iclass_second_keystringNCardLayout iClass Second Key 
desfire_primary_keystringNCardLayout Desfire Primary Key
desfire_second_keystringNCardLayout Desfire Second Key
seos_primary_keystringNCardLayout Seos Primary Key
seos_second_keystringNCardLayout Seos Second Key 
seos_adf stringNCardLayout Seos Adf
namestringYCardLayout Name
desfire_advanced_modeintegerNCardLayout 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 : 

ParameterDescription
idId of device to add the smart card layout 


Body Parameters : 

Use "id" value obtained from Step 1. 

ParameterTypeRequiredDescription
card_layout:idintegerYId 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.