Card Deactivation Report

This Report shows all cards that have been deactivated with in the provided time period. This is how the Windows client achieves this report.

Example in C#

var currentInstance  = await client.GetCurrentInstanceAsync();
var app = (await client.GetAppsAsync(currentInstance)).Where(a=> a.ApiKey == "KeepApi").FirstOrDefault(); 
var includeSubFolders = false;
var includeSharedInstances = false;
var spanScope = false;
var requiresAck = false;
var priorityThreshold = 0;
var forKeys = new[] {app.Key};
var query = "{ $and: [ { 'EventData.Action': 'PUT' }, { 'EventData.Types': 'CardAssignment' } ], $or: [ { 'EventData.AfterData.IsDisabled': true }, { 'EventData.AfterData.ExpiresOn' : { $lte: new Date() } } ] }";
// Returns: IEnumerable<EventMessageData>		
var eventMessageData = await client.GetEventsAsync(currentInstance, 0, pageSize:1000, includeSubFolders, includeSharedInstances,  spanScope, requiresAck, startingOn: new DateTime(2017,06,23), endingOn: DateTime.UtcNow, priorityThreshold: priorityThreshold, forKeys: forKeys, query: query);

Example in CURL

curl -X GET \
  'https://keepapi.feenicshosting.com/api/f/INSTANCE_KEY_HERE/events?page=0&pageSize=1000&includeSubFolders=False&includeSharedInstances=False&spanScope=False&requiresAck=False&startingOn=2017-06-23T04%3A00%3A00z&endingOn=2019-06-27T12%3A11%3A18z&priorityThreshold=0&forKeys=KEEP_API_APP_KEY&query=%7B%20%24and%3A%20%5B%20%7B%20%27EventData.Action%27%3A%20%27PUT%27%20%7D%2C%20%7B%20%27EventData.Types%27%3A%20%27CardAssignment%27%20%7D%20%5D%2C%20%24or%3A%20%5B%20%7B%20%27EventData.AfterData.IsDisabled%27%3A%20true%20%7D%2C%20%7B%20%27EventData.AfterData.ExpiresOn%27%20%3A%20%7B%20%24lte%3A%20new%20Date%28%29%20%7D%20%7D%20%5D%20%7D' \
  -H 'Accept: */*' \
  -H 'Authorization: Bearer TOKEN_GOES_HERE'  \
  -H 'Connection: keep-alive' \
  -H 'Host: keepapi.feenicshosting.com' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'cache-control: no-cache'

The Query Parameter in a GetEventsAsync call is the same as creating parameters inside a Match section of a mongodb pipeline aggregate.

The Query (the query parameter) in the the call in Json is as follows.

Example Of Aggregate Used in JSON

{ 
    "$and": 
    [ 
        { "EventData.Action": "PUT" },
        { "EventData.Types": "CardAssignment" } 
    ], 
    "$or": 
    [ 
        { "EventData.AfterData.IsDisabled": true }, 
        { "EventData.AfterData.ExpiresOn" : { "$lte": "2019-06-27T12%3A11%3A18z" } } 
    ] 
}