Area Report

Example in C#

var currentInstance  = await client.GetCurrentInstanceAsync();
var operations = 
	new BsonDocument[] 
	{ 
	    new BsonDocument("$match", 
	    new BsonDocument
	        {
	            { "InFolderId", new ObjectId(currentInstance.Key) }, 
	            { "_t", "Person" }
	        }),
	    new BsonDocument("$unwind", 
	    new BsonDocument("path", "$ObjectLinks")),
	    new BsonDocument("$match", 
	    new BsonDocument("ObjectLinks.Relation", "InArea")),
	    new BsonDocument("$project", 
	    new BsonDocument
	        {
	            { "_id", 0 }, 
	            { "GivenName", 1 }, 
	            { "Surname", 1 }, 
	            { "ObjectLinks.CommonName", 1 }, 
	            { "Metadata", 1 }
	        })
	};

var AreaReport = await client.AggregateAsync(currentInstance, "KeepObjects", operations);

var currentInstance  = await client.GetCurrentInstanceAsync();
var operations = 
	new BsonDocument[] 
	{ 
	    new BsonDocument("$match", 
	    new BsonDocument
	        {
	            { "InFolderId", new ObjectId(currentInstance.Key) }, 
	            { "_t", "Person" }
	        }),
	    new BsonDocument("$project", 
	    new BsonDocument
	        {
	            { "_id", 0 }, 
	            { "GivenName", 1 }, 
	            { "Surname", 1 }, 
	            { "ObjectLinks ", 1 }, 
	            { "Metadata", 1 }
	        })
	};

var AreaReport = await client.AggregateAsync(currentInstance, "KeepObjects", operations);

Example in CURL

curl -X POST \
  'https://keepapi.feenicshosting.com/api/f/INSTANCE_KEY_HERE/aggregate/KeepObjects?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: 337' \
  -d '["
        { 
            \"$match\" : 
            { 
                \"InFolderId\" : ObjectId(\"INSTANCE_KEY_HERE\"), 
                \"_t\" : \"Person\" } 
        }","
        { \"$unwind\" : { \"path\" : \"$ObjectLinks\" } }","
        { \"$match\" : { \"ObjectLinks.Relation\" : \"InArea\" } }","
        { 
            \"$project\" : 
            { 
                \"_id\" : 0, 
                \"GivenName\" : 1, 
                \"Surname\" : 1, 
                \"ObjectLinks.CommonName\" : 1, 
                \"Metadata\" : 1 
            } 
        }"
    ]'

Example Of Aggregate Used in JSON

[
    { 
        "$match" : 
        { 
            "InFolderId" : ObjectId("INSTANCE_KEY_HERE"), 
            "_t" : "Person" } 
    },
    { "$unwind" : { "path" : "$ObjectLinks" } },
    { "$match" : { "ObjectLinks.Relation" : "InArea" } },
    { 
        "$project" : 
        { 
            "_id" : 0, 
            "GivenName" : 1, 
            "Surname" : 1, 
            "ObjectLinks.CommonName" : 1, 
            "Metadata" : 1 
        } 
    }
]