Search documentation
karat

+

K

User Documentation ↗

Aggregate Objects

POST/api/v2/ontologies/{ontology}/objects/{objectType}/aggregate

Perform functions on object fields in the specified ontology and object type.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:ontologies-read.

Path parameters

ontology
string

The API name of the ontology. To find the API name, use the List ontologies endpoint or check the Ontology Manager.

objectType
string

The type of the object to aggregate on.

Query parameters

artifactRepository
string
optional

The repository associated with a marketplace installation.

packageName
string
optional

The package name of the generated SDK.

Request body

AggregateObjectsRequestV2
object
Hide child attributes

Hide child attributes

aggregation
list<AggregationV2>
optional
Show child attributes

Show child attributes

where
union
optional
Show child attributes

Show child attributes

groupBy
list<AggregationGroupByV2>
optional
Show child attributes

Show child attributes

accuracy
string (enum)
optional

Enum values: REQUIRE_ACCURATE, ALLOW_APPROXIMATE

Response body

AggregateObjectsResponseV2
object

Success response.

Hide child attributes

Hide child attributes

excludedItems
integer
optional
accuracy
string (enum)

Enum values: ACCURATE, APPROXIMATE

data
list<AggregateObjectsResponseItemV2>
optional
Show child attributes

Show child attributes

Examples

Request

Copied!
1 2 3 4 5 curl -X POST \ -H "Content-type: application/json" \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/ontologies/palantir/objects/employee/aggregate" \ -d '{"aggregation":[{"type":"min","field":"properties.tenure","name":"min_tenure"},{"type":"avg","field":"properties.tenure","name":"avg_tenure"}],"query":{"not":{"field":"name","eq":"john"}},"groupBy":[{"field":"startDate","type":"range","ranges":[{"startValue":"2020-01-01","endValue":"2020-06-01"}]},{"field":"city","type":"exact"}]}'

Response

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 { "data": [ { "metrics": [ { "name": "min_tenure", "value": 1 }, { "name": "avg_tenure", "value": 3 } ], "group": { "startDate": { "startValue": "2020-01-01", "endValue": "2020-06-01" }, "city": "New York City" } }, { "metrics": [ { "name": "min_tenure", "value": 2 }, { "name": "avg_tenure", "value": 3 } ], "group": { "startDate": { "startValue": "2020-01-01", "endValue": "2020-06-01" }, "city": "San Francisco" } } ] }