SmartCardReader
Get smartcard reader state
This returns the SmartCardReaderState.
URL parameters
hostIp: Ip address of the API host.
deviceId: Id of the smartcardreader.
- GET https://{hostIp}:7081/hal/devices/{deviceId}/smartcardreader
Example request:
GET /hal/devices/smartcardreader1/smartcardreader HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS...
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "smartCardReaderStates": [2,32,256], "smartCardType":1 }
- Status Codes:
200 OK – OK
400 Bad Request – Bad Request. A descriptive error comes along with this error.
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
500 Internal Server Error – Internal Server Error
- Response Headers:
Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)
- Response JSON Object:
smartCardReaderStates (array) – an array of SCardState values. see SCardState for more info.
smartCardType (integer) – the type of the inserted smartcard (if any). see SCardType enumeration for more info.
Get smartcard files
This returns the content of a file available on the smartcard.
URL parameters
hostIp: Ip address of the API host.
deviceId: Id of the smartcardreader.
fileId: integer. Id of the file to be read. The id depends on the smart card type . See file ids for more info.
- GET https://{hostIp}:7081/hal/devices/{deviceId}/smartcardreader/files/{fileId}
Example request:
GET /hal/devices/smartcardreader1/smartcardreader/files/1 HTTP/1.1 Accept: application/json Authorization: Bearer eyJhbGciOiJS...
Example response:
HTTP/1.1 200 OK Content-Type: application/json; charset=utf-8 { "version": "string", "cardNumber": "string", ... }
- Status Codes:
200 OK – OK
400 Bad Request – Bad Request. A descriptive error comes along with this error.
401 Unauthorized – Unauthorized. Something is wrong with the Authorization header of the request
403 Forbidden – Forbidden. Something is wrong with the claims of the user.
404 Not Found – Not Found. The requested file could not be found.
500 Internal Server Error – Internal Server Error
- Response Headers:
Content-Type – defines the serialization format for the response body (this depends on the Accept header of the request)
- Response JSON Object:
fileData (object) – The response body contains the content of the requested file if the file id exists and if a smartcard is inserted. See file ids for more info.
Enumeration values
Enumeration SCardState
Indicates the state of the reader
Unaware = 0
Ignore = 1 : reader should be ignored
Changed = 2 : state has changed
Unknown = 4 : unknown reader
Unavailable = 8 : state not available for this reader
Empty = 16 : no card in reader
Present = 32 : card in reader
AtrMatch = 64 : atr match
Exclusive = 128 : the card in the reader is allocated by an application exclusively
InUse = 256 : the card is in use by one or more applications
Mute = 512 : there is an unresponsive card in the reader
Unpowered = 1024 : the card is unpowered
Enumeration SCardType
Indicates the card type of the inserted smartcard.
Unknown = 0
BEID = 1
SLE4442 = 2
Enumeration card file ids
enumeration FileIds:
ID = 1 (BEID)
Address = 2 (BEID)
Photo = 3 (BEID)
SLE4442Data (SLE4442)
File content schema’s
BEID.ID
{
"version": "string",
"cardNumber": "string,
"chipNumber": "string",
"validityDateBegin":"string",
"validityDateEnd":"string",
"nationalNumber":"string",
"name":"string",
"firstName1":"string",
"firstName2":"string",
"nationality":"string",
"birthLocation":"string",
"birthDate":"string",
"sex":"string",
"nobleCondition":"string",
"documentType":int,
"whiteCane":bool,
"yellowCane":bool,
"extendedMinority":bool,
"hashPhoto":"string",
"rfu":"string"
}
BEID.Address
{
"version":"string",
"street":"string",
"streetNumber":"string",
"boxNumber":"string",
"zip":"string";
"municipality":"string",
"country":"string",
"rfu":"string"
}
BEID.Photo
Base64 string of binary image.
SLE4442.Data
256bytes in Hex Format
"A2131091FFFF8115FFFFFFFFFFFFFFFF00040000FDD27600000400FFFFFFF...FF"
Events
SmartCardReader Events
The websocket server will send updates to a registered websocket client when a card is inserted or retracted.
The event has the following format:
"messageType":1,
"data":
{
"methodName":"receiveSmartCardReaderState",
"arguments": [{
"smartCardReaderStates": [2,32,256], //see SCardState enumeration value
"smartCardType": 1, //see SCardType enumeration value
"deviceId": "smartcardreader1",
"version": "1.0"
}]
}