Event History Report

This grabs event history for the last 4 hours using an aggregate. The Windows client uses GetEventsAsync for this report with the same parameters.

Example in C#

var currentInstance  = await client.GetCurrentInstanceAsync();
var operations = 
	new BsonDocument[] 
	{ 
	 new BsonDocument("$match", 
	    new BsonDocument
	        {
	            { "InFolderId", 
	    new ObjectId(currentInstance.Key)}, 
	            { "OccurredOn.Date", 
	    new BsonDocument
	            {
	                { "$lte", 
	     DateTime.UtcNow }, 
	                { "$gt", 
	    DateTime.UtcNow.AddHours(-4) }
	            } }
    }),
    new BsonDocument("$sort", 
    	new BsonDocument("OccurredOn", -1)),
	new BsonDocument("$skip",0),
	new BsonDocument("$limit",1000),
    new BsonDocument("$project", 
	    new BsonDocument
        {
            { "_id", 0 }, 
            { "_t", 1 }, 
            { "EventData", 1 }, 
            { "OccurredOn", 1 }, 
            { "MessageShort", 1 }, 
            { "ObjectLinks", 1 }
        })
	};

var History = await client.AggregateAsync(currentInstance, "Events", operations);

Example in CURL

curl -X POST \
  'https://keepapi.feenicshosting.com/api/f/INSTANCE_KEY_HERE/aggregate/Events?queryTimeout=30&jsonStrict=False%20' \
  -H 'Accept: */*' \
  -H 'Authorization: Bearer TOKEN_GOES_HERE'  \
  -H 'Connection: keep-alive' \
  -H 'Content-Type: application/json' \
  -H 'Host: keepapi.feenicshosting.com' \
  -H 'accept-encoding: gzip, deflate' \
  -H 'cache-control: no-cache' \
  -H 'content-length: 422' \
  -d '["
        { 
            \"$match\" : 
            { 
                \"InFolderId\" : ObjectId(\"INSTANCE_KEY_HERE\"),
                \"OccurredOn.Date\" : 
                { 
                    \"$lte\" : ISODate(\"2019-06-27T13:52:48.975Z\"), 
                    \"$gt\" : ISODate(\"2019-06-27T09:52:48.976Z\") 
                } 
            } 
        }","
        { \"$sort\" : { \"OccurredOn\" : -1 } }","
        { \"$skip\" : 0 }","
        { \"$limit\" : 1000 }","
        { 
            \"$project\" : 
            { 
                \"_id\" : 0, 
                \"_t\" : 1, 
                \"EventData\" : 1, 
                \"OccurredOn\" : 1, 
                \"MessageShort\" : 1, 
                \"ObjectLinks\" : 1 
            } 
        }"
    ]'

Example Of Aggregate Used in JSON

[
    { 
        "$match" : 
        { 
            "InFolderId" : ObjectId("INSTANCE_KEY_HERE"),
            "OccurredOn.Date" : 
            { 
                "$lte" : ISODate("2019-06-27T13:52:48.975Z"), 
                "$gt" : ISODate("2019-06-27T09:52:48.976Z") 
            } 
        } 
    },
    { "$sort" : { "OccurredOn" : -1 } },
    { "$skip" : 0 },
    { "$limit" : 1000 },
    { 
        "$project" : 
        { 
            "_id" : 0, 
            "_t" : 1, 
            "EventData" : 1, 
            "OccurredOn" : 1, 
            "MessageShort" : 1, 
            "ObjectLinks" : 1 
        } 
    }
]