const events = await client.events.list({ filter: { startTime: { min: new Date('1 jan 2018') }, endTime: { max: new Date('1 jan 2019') } } });{
"items": [
{
"id": 4503599627370496,
"lastUpdatedTime": 1730204346000,
"createdTime": 1730204346000,
"externalId": "my.known.id",
"dataSetId": 4503599627370496,
"startTime": 1730204346000,
"endTime": 1730204346000,
"type": "<string>",
"subtype": "<string>",
"description": "<string>",
"metadata": {},
"assetIds": [
4503599627370496
],
"source": "<string>"
}
],
"nextCursor": "<string>"
}Required capabilities:
eventsAcl:READ
Retrieve a list of events in the same project. This operation supports pagination by cursor. Apply Filtering and Advanced filtering criteria to select a subset of events.
Advanced filter lets you create complex filtering expressions that combine simple operations,
such as equals, prefix, exists, etc., using boolean operators and, or, and not.
It applies to basic fields as well as metadata.
See the advancedFilter attribute in the example.
See more information about filtering DSL here.
| Leaf filter | Supported fields | Description |
|---|---|---|
containsAll | Array type fields | Only includes results which contain all of the specified values. {"containsAll": {"property": ["property"], "values": [1, 2, 3]}} |
containsAny | Array type fields | Only includes results which contain at least one of the specified values. {"containsAny": {"property": ["property"], "values": [1, 2, 3]}} |
equals | Non-array type fields | Only includes results that are equal to the specified value. {"equals": {"property": ["property"], "value": "example"}} |
exists | All fields | Only includes results where the specified property exists (has value). {"exists": {"property": ["property"]}} |
in | Non-array type fields | Only includes results that are equal to one of the specified values. {"in": {"property": ["property"], "values": [1, 2, 3]}} |
prefix | String type fields | Only includes results which start with the specified value. {"prefix": {"property": ["property"], "value": "example"}} |
range | Non-array type fields | Only includes results that fall within the specified range. {"range": {"property": ["property"], "gt": 1, "lte": 5}} Supported operators: gt, lt, gte, lte |
search | ["description"] | Introduced to provide functional parity with /events/search endpoint. {"search": {"property": ["property"], "value": "example"}} |
The search leaf filter provides functional parity with the /events/search endpoint.
It’s available only for the ["description"] field. When specifying only this filter with no explicit ordering,
behavior is the same as of the /events/search/ endpoint without specifying filters.
Explicit sorting overrides the default ordering by relevance.
It’s possible to use the search leaf filter as any other leaf filter for creating complex queries.
See the search filter in the advancedFilter attribute in the example.
and and or clauses must have at least one elementproperty array of each leaf filter has the following limitations:
containsAll, containsAny, and in filter values array size must be in the range [1, 100]containsAll, containsAny, and in filter values array must contain elements of a primitive type (number, string)range filter must have at least one of gt, gte, lt, lte attributes.
But gt is mutually exclusive to gte, while lt is mutually exclusive to lte.
For metadata, both upper and lower bounds must be specified.gt, gte, lt, lte in the range filter must be a primitive valuesearch filter value must not be blank and the length must be in the range [1, 128]externalId - 255description - 128 for the search filter and 255 for other filterstype - 64subtype - 64source - 128metadata key - 128By default, events are sorted by their creation time in the ascending order.
Use the search leaf filter to sort the results by relevance.
Sorting by other fields can be explicitly requested. The order field is optional and defaults
to desc for _score_ and asc for all other fields.
The nulls field is optional and defaults to auto. auto is translated to last
for the asc order and to first for the desc order by the service.
Partitions are done independently of sorting: there’s no guarantee of the sort order between elements from different partitions.
See the sort attribute in the example.
In case the nulls attribute has the auto value or the attribute isn’t specified,
null (missing) values are considered to be bigger than any other values.
They are placed last when sorting in the asc order and first when sorting in desc.
Otherwise, missing values are placed according to the nulls attribute (last or first), and their placement doesn’t depend on the order value.
Values, such as empty strings, aren’t considered as nulls.
Use a special sort property _score_ when sorting by relevance.
The more filters a particular event matches, the higher its score is. This can be useful,
for example, when building UIs. Let’s assume we want exact matches to be be displayed above matches by
prefix as in the request below. An event with the type fire will match both equals and prefix
filters and, therefore, have higher score than events with names like fire training that match only the prefix filter.
"advancedFilter" : {
"or" : [
{
"equals": {
"property": ["type"],
"value": "fire"
}
},
{
"prefix": {
"property": ["type"],
"value": "fire"
}
}
]
},
"sort": [
{
"property" : ["_score_"]
}
]
This endpoint is meant for data analytics/exploration usage and is not suitable for high load data retrieval usage. It is a subject of the new throttling schema (limited request rate and concurrency). Please check Events resource description for more information.
const events = await client.events.list({ filter: { startTime: { min: new Date('1 jan 2018') }, endTime: { max: new Date('1 jan 2019') } } });{
"items": [
{
"id": 4503599627370496,
"lastUpdatedTime": 1730204346000,
"createdTime": 1730204346000,
"externalId": "my.known.id",
"dataSetId": 4503599627370496,
"startTime": 1730204346000,
"endTime": 1730204346000,
"type": "<string>",
"subtype": "<string>",
"description": "<string>",
"metadata": {},
"assetIds": [
4503599627370496
],
"source": "<string>"
}
],
"nextCursor": "<string>"
}Access token issued by the CDF project's configured identity provider. Access token must be an OpenID Connect token, and the project must be configured to accept OpenID Connect tokens. Use a header key of 'Authorization' with a value of 'Bearer $accesstoken'. The token can be obtained through any flow supported by the identity provider.
Cursor for paging through results. In general, if a response contains a nextCursor
property, it means that there may be more results, and you should pass that value as the
cursor parameter in the next request.
Note that the cursor may or may not be encrypted, but either way, it is not intended to be decoded. Its internal structure is not a part of the public API, and may change without notice. You should treat it as an opaque string and not attempt to craft your own cursors.
Filter on events filter with exact match
Show child attributes
A query that matches items matching boolean combinations of other queries.
It's built using one or more boolean clauses of the following types: and, or, or not
Show child attributes
{
"or": [
{
"not": {
"and": [
{
"equals": {
"property": ["metadata", "severity"],
"value": "medium"
}
},
{
"in": {
"property": ["source"],
"values": ["inspection protocol", "incident report"]
}
},
{
"range": {
"property": ["dataSetId"],
"gte": 1,
"lt": 10
}
}
]
}
},
{
"and": [
{
"equals": {
"property": ["type"],
"value": "equipment malfunction"
}
},
{
"equals": {
"property": ["subtype"],
"value": "mechanical failure"
}
}
]
},
{
"search": {
"property": ["description"],
"value": "outage"
}
}
]
}Limits the maximum number of results to be returned by a single request. In case there are more results to the request, the 'nextCursor' attribute will be provided as part of the response. Request may contain less results than the request limit.
1 <= x <= 1000Sort by array of selected properties.
2Show child attributes
[
{
"property": ["createdTime"],
"order": "desc"
},
{
"property": ["metadata", "FooBar"],
"nulls": "first"
}
]"4zj0Vy2fo0NtNMb229mI9r1V3YG5NBL752kQz1cKtwo"
Splits the data set into N partitions.
The attribute is specified as a "M/N" string, where M is a natural number in the interval of [1, N].
You need to follow the cursors within each partition in order to receive all the data.
The maximum number of allowed partitions (N) is 10.
Cognite rejects requests if you specify more than 10 partitions. When Cognite enforces this behavior, the requests result in a 400 Bad Request status.
"1/3"
Was this page helpful?