REST API PCSC Routes PCSC Connect
April 13, 2023 at 2:39 AMConnect to the card in the reader
Role
This method gives access to the SCardConnect function.
If the reader is already connected, it will failed because a client has the handle to this card.
When connected a 10s timer will be started and will be reseted at each command (Transmit or control). When the timer reach its end, the card is disconnected.
Request
URL : /pcsc/reader/{$id}/connect
Method : POST
URL Params : {$id}
: the ReaderId of the device. Use GET /pcsc/readers to enumerate the available readers.
Content : None
Success Response
Code : 200 OK
Content : an object providing the details of the connected card, as specified below.
Response content
Field name | Type | Status | Description |
---|---|---|---|
Result |
string | always | success if the PC/SC subsystem has returned SCARD_S_SUCCESS |
Protocol |
string | always | The protocol that has been negotiated between the reader and the card. Either T=0 or T=1 |
ATR |
string | always | The card’s ATR (answer to reset), as an hexadecimal string |
Token |
string | always | The token that must be provided to any subsequent command send to this card until a disconnect happen |
Example
{
"Result": "success",
"Protocol": "T=1",
"ATR": "3B8F8001804F0CA000000306030001000000006A",
"Token": "0AAZZevyX99hu1Py0Suib6"
}
Error Response
See Error Responses. An ERROR object is returned in case of a PC/SC-specific error, with the Error
field present and populated.
Examples
No card in the reader
{
"Result": "error",
"Error": "SCARD_E_NO_SMARTCARD",
"Message": "The operation requires a Smart Card, but no Smart Card is currently in the device."
}
The card has already been connected by another application
{
"Result": "error",
"Error": "SCARD_E_SHARING_VIOLATION",
"Message": "The smart card cannot be accessed because of other connections outstanding."
}