Audit Logs Report

This will give you the most recent events in the last 10 hours upto 1000 events. You can add custom query attributes to this call, like the aggregate below.

Example in C#

var Folder = await client.GetCurrentInstanceAsync();
var app =  await client.GetAppByApiKeyAsync(Folder, "KeepApi"); 
var query =  "";
int i =0;
var keepObjects = (await client.GetEventsAsync(Folder, page: i, pageSize: 1000, startingOn: DateTime.UtcNow.AddHours(-10), endingOn: DateTime.UtcNow, query: query, forKeys: new[] { app.Key }));

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=2019-06-26T08%3A56%3A40z&endingOn=2019-06-26T18%3A56%3A40z&priorityThreshold=0&forKeys=KEEP_API_APP_KEY&query=%20' \
  -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'

Audit Logs Report - Using an Aggregate

This will give you the most recent events in the last 10 hours upto 1000 events. This should do the exact same thing as the function above but shows a different method of how to do it.

Example in C#

var currentInstance  = await client.GetCurrentInstanceAsync();
var operations = 
	new BsonDocument[] 
	{ 
	 new BsonDocument("$match", 
	    new BsonDocument
	        {
	            	{ "InFolderId", 
	    			new ObjectId("INSTANCE_KEY_HERE") }, 
			{ "AppId", 
    				new ObjectId("KEEP_API_APP_KEY") },
	            	{ "OccurredOn.Date", 
	    			new BsonDocument
		            {
		                { "$lte", DateTime.UtcNow }, 
			            { "$gt", DateTime.UtcNow.AddHours(-10) }
	            	} }
    }),
    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 Audit = 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: 474' \
  -d '["
        { 
            \"$match\" : 
            { 
                \"InFolderId\" : ObjectId(\"INSTANCE_KEY_HERE\"),
                \"AppId\" : ObjectId(\"KEEP_API_APP_KEY\"),
                \"OccurredOn.Date\" : 
                {
                    \"$lte\" : ISODate(\"2019-06-26T19:16:06.792Z\"),
                    \"$gt\" : ISODate(\"2019-06-26T09:16:06.792Z\") 
                } 
            } 
        }","
        { \"$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"),
            "AppId" : ObjectId("KEEP_API_APP_KEY"),
            "OccurredOn.Date" : 
            {
                "$lte" : ISODate("2019-06-26T19:16:06.792Z"),
                "$gt" : ISODate("2019-06-26T09:16:06.792Z") 
            } 
        } 
    },
    { "$sort" : { "OccurredOn" : -1 } },
    { "$skip" : 0 }","
    { "$limit" : 1000 },
    { 
        "$project" : 
        { 
            "_id" : 0, 
            "_t" : 1, 
            "EventData" : 1, 
            "OccurredOn" : 1, 
            "MessageShort" : 1, 
            "ObjectLinks" : 1 
        } 
    }
]