6.1 Card Plug-in

You can browse the following URL to check the Card service:

https://127.0.0.1:8440/api/v1/card/getmessage?nowait

The response is displayed in the following format:

{
result: [<status>],
cardid: <card id>,
readerid: <reader id>
}

The following table describes the different status that the Card service displays as a response.

Status

Description

NO_READER

The Card service has not detected the connected card reader

READER_ON

The Card service has detected the connected card reader

NO_CARD

There is no card on the reader

CARD_ON

A card is presented to the reader

NOTE:The cardid parameter is used only with the CARD_ON and NO_CARD statuses.

The following table lists the GET methods and the respective response that the Card service returns.

Method

Response

https://127.0.0.1:8440/api/v1/card/getmessage?nowait

Displays the current status of the reader and card instantly.

Possible status values are:

  • NO_READER

  • NO_CARD

  • CARD_ON

https://127.0.0.1:8440/api/v1/card/getmessage?wait

Waits for the next action.

For example, tapping or removal of a card from the reader.

NOTE:If you disconnect the reader with a card placed on the reader, two messages NO_CARD and NO_READER are displayed. But the first one will be caught with getmessage?wait.

When you connect a reader with a card on, two events READER_ON and CARD_ON take place. As a result, READER_ON is displayed as response.

https://127.0.0.1:8440/api/v1/card/getreaderon?nowait

Displays the current status of reader.

Possible status values are:

  • READER_ON

  • NO_READER

https://127.0.0.1:8440/api/v1/card/getreaderon?wait

Displays READER_ON if the reader is connected or waits till you connect the reader.

https://127.0.0.1:8440/api/v1/card/getcardon?nowait

Displays the current status of card.

Possible status values:

  • NO_READER

  • NO_CARD

  • CARD_ON

https://127.0.0.1:8440/api/v1/card/getcardon?wait

Displays NO_READER if a reader is not connected or waits till a card is presented on the reader.

NOTE:If a card is present on the reader, the service waits for the next tap of the card.

https://127.0.0.1:8440/api/v1/card/getcardoff?nowait&cardid=<cardid>

Possible status values:

  • NO_READER

  • NO_CARD

  • CARD_ON

Use the cardid parameter to make the service wait when a specific card is removed.

https://127.0.0.1:8440/api/v1/card/getcardoff?wait

Possible status values:

  • NO_READER

  • NO_CARD

If a card is present on the reader, the service waits till the card is removed from the reader.

https://127.0.0.1:8440/api/abort?cancel-cookie=xxx

All the wait methods support cancel-cookie=xxx parameter.

For example, https://127.0.0.1:8440/api/v1/card/getmessage?wait&cancel-cookie=xxx. If you call abort with the cancel-cookie, all the waiting methods with the specified cookie are terminated.