Card Assignments are used to keep track of the physical cards that a person carries. A proper card assignment at the minimum contains the card’s display number and the encoded card number. The method GetRandomPinAsync picks a random unused card pin. Also ensure to provide the date when the card should be active and when the card should expire. Note there is no way to completely delete a card once it has been entered into the system.
For more information on Card Assignments and the methods used please look at CardAssignmentInfo.
Example in C#
//The Random Pin Step is not necessary and should only be used for making a pin not a card number.
var cardNum = await client.GetRandomPinAsync(currentInstance, 100000, 999999);
var cardAssignment = await client.AddCardAssignmentAsync(person, new CardAssignmentInfo
{
AntiPassbackExempt = false,
DisplayCardNumber = cardNum.ToString(),
EncodedCardNumber = cardNum,
ActiveOn = DateTime.UtcNow, //today's date
ExpiresOn = DateTime.UtcNow.AddYears(1), //one year into the future
ExtendedAccess = false
});
Example in CURL
#The Random Pin Step is not necessary and should only be used for making a pin not a card number.
#Get an available Pin number
curl -X GET \
'https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/randompin?lowValue=100000&highValue=999999' \
-H 'Authorization: Bearer TOKEN_GOES_HERE'
curl -X POST \
https://keepapi.feenicshosting.com/api/f/INSTANCE.KEY/people/PERSON.KEY/cards \
-H 'Authorization: Bearer TOKEN_GOES_HERE' \
-H 'Content-Type: application/json' \
-d '{
"$type":"Feenics.Keep.WebApi.Model.CardAssignmentInfo, Feenics.Keep.WebApi.Model",
"Key":null,
"EncodedCardNumber":CARD_NUMBER_HERE,
"DisplayCardNumber":"CARD_NUMBER_HERE",
"ActiveOn":"2019-02-22T20:51:31.4443735Z",
"ExpiresOn":"2020-02-22T20:51:31.4443735Z",
"PinCode":null,
"AntiPassbackExempt":false,
"ExtendedAccess":false,
"PinExempt":false,
"IsDisabled":false,
"ManagerLevel":0,
"OriginalUseCount":null,
"CurrentUseCount":0,
"Note":null,
"HexValue":null,
"RecordId":null,
"LastUsed":null,
"Href":null
}'