Simulate a Card Read

In order to simulate a card read we need to publish an event to the object that we would like to simulate. A card read can be simulated by using the simulateCardRead. This command sends all the information of a card to the reader and will behave as if that card was at the reader itself.

For more information on Events and the methods used please look at EventTypeInfo.

For multiple examples on the Publish Method and more detail on Hardware commands please see the following links.

Possible Mercury Commands: Mercury Service Commands

Possible Bosch Commands: Bosch Service Commands

Possible Engage Commands: Engage Service Commands

For more examples of Commands look at the Ldap Commands: LDAP Service Commands

Example in C#

await client.PublishEventAsync(currentInstance, 
    "MercuryCommands", 
    new MonikerItem
    {
        Namespace = "MercuryServiceCommands",
        Nickname = "mercury:command-simulateCardRead" 
    },
    DateTime.UtcNow,
    new {   Reason = "learning how to use the api" ,
            FacilityCode = 44,
            EncodedCardNumber = 1111000000},
    reader.AsObjectLink("Reader"),
    cardFormat.AsObjectLink("CardFormat"),
    controller.AsObjectLink("Controller")
);

Example in CURL

curl -X POST \
  https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/eventmessagesink \
  -H 'Authorization:  Bearer TOKEN_GOES_HERE' \
  -H 'Content-Type: application/json' \
  -d '{
        "$type":"Feenics.Keep.WebApi.Model.EventMessagePosting, Feenics.Keep.WebApi.Model",
        "OccurredOn":"2019-01-23T19:30:49.10947Z",
        "AppKey":"MercuryCommands",
        "EventTypeMoniker":
        {
            "$type":"Feenics.Keep.WebApi.Model.MonikerItem, Feenics.Keep.WebApi.Model",
            "Namespace":"MercuryServiceCommands",
            "Nickname":"mercury:command-simulateCardRead"
        },
        "RelatedObjects":
        [
            {
                "$type":"Feenics.Keep.WebApi.Model.ObjectLinkItem, Feenics.Keep.WebApi.Model",
                "Href":"/api/f/5b61d62492dacd062c424424/peripherals/5c48bbc992dacd12e4e824d8",
                "LinkedObjectKey":"5c48bbc992dacd12e4e824d8",
                "CommonName":"cURL_Reader",
                "Relation":"Reader",
                "MetaDataBson":null
            },
            {
                "$type":"Feenics.Keep.WebApi.Model.ObjectLinkItem, Feenics.Keep.WebApi.Model",
                "Href":"/api/f/5b61d62492dacd062c424424/cardformats/5c48b0e692dacd12e4e824c9",
                "LinkedObjectKey":"5c48b0e692dacd12e4e824c9",
                "CommonName":"cURL_Example_Format",
                "Relation":"CardFormat",
                "MetaDataBson":null
            },
            {
                "$type":"Feenics.Keep.WebApi.Model.ObjectLinkItem, Feenics.Keep.WebApi.Model",
                "Href":"/api/f/5b61d62492dacd062c424424/controllers/5c48b17792dacd093801d79a",
                "LinkedObjectKey":"5c48b17792dacd093801d79a",
                "CommonName":"ControllerExampleForCurl",
                "Relation":"Controller",
                "MetaDataBson":null
            }
        ],
        "EventDataBsonBase64":"VgAAAAJSZWFzb24AHAAAAGxlYXJuaW5nIGhvdyB0byB1c2UgdGhlIGFwaQAQRmFjaWxpdHlDb2RlACwAAAAQRW5jb2RlZENhcmROdW1iZXIAwIM4QgA="
    }'