curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/streams/{streamId}/records/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sources": [
{
"source": {
"type": "container,",
"space": "mySpace,",
"externalId": "myContainer"
},
"properties": [
"someProperty"
]
}
],
"filter": {
"and": [
{
"containsAll": {
"property": [
"mySpace",
"myContainer",
"myProperty"
],
"values": [
10011,
10012
]
}
},
{
"range": {
"property": [
"my_space",
"my_container",
"my_weight"
],
"gte": 0
}
}
]
},
"cursor": "c29tZSBjdXJzb3I=",
"initializeCursor": "42d-ago",
"targetUnits": {
"unitSystemName": "<string>"
},
"includeTyping": true,
"limit": 42
}
'{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"createdTime": 1720616232,
"lastUpdatedTime": 1720616232,
"status": "created",
"properties": {}
}
],
"nextCursor": "c29tZSBjdXJzb3I=",
"hasNext": true,
"typing": {}
}Required capabilities:
StreamRecordsAcl:READDataModelsAcl:READ
Subscribe to changes for records from the stream, matching a supplied filter.
curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/streams/{streamId}/records/sync \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"sources": [
{
"source": {
"type": "container,",
"space": "mySpace,",
"externalId": "myContainer"
},
"properties": [
"someProperty"
]
}
],
"filter": {
"and": [
{
"containsAll": {
"property": [
"mySpace",
"myContainer",
"myProperty"
],
"values": [
10011,
10012
]
}
},
{
"range": {
"property": [
"my_space",
"my_container",
"my_weight"
],
"gte": 0
}
}
]
},
"cursor": "c29tZSBjdXJzb3I=",
"initializeCursor": "42d-ago",
"targetUnits": {
"unitSystemName": "<string>"
},
"includeTyping": true,
"limit": 42
}
'{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"createdTime": 1720616232,
"lastUpdatedTime": 1720616232,
"status": "created",
"properties": {}
}
],
"nextCursor": "c29tZSBjdXJzb3I=",
"hasNext": true,
"typing": {}
}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.
An identifier of the stream where the records are stored.
1 - 100^[a-z]([a-z0-9_-]{0,98}[a-z0-9])?$"test1"
Change filter specification.
List of containers and their properties which values should be selected for the response.
1 - 10 elementsShow child attributes
Build a new query by combining other queries, using boolean operators. We support the and, or, and
not boolean operators.
Show child attributes
{
"and": [
{
"containsAll": {
"property": ["mySpace", "myContainer", "myProperty"],
"values": [10011, 10012]
}
},
{
"range": {
"property": ["my_space", "my_container", "my_weight"],
"gte": 0
}
}
]
}A cursor returned from the previous sync request.
1 - 100000"c29tZSBjdXJzb3I="
The format is "duration-ago", where duration is a correct duration representation: 3m, 400h, 25d, etc.
For instance, "2d-ago" will give a stream of changes ingested up to 2 days ago.
If cursor is not set, initializeCursor is used to choose a shift where to start the stream reading.
If initializeCursor is not set, the cursor is required. If the cursor is provided, initializeCursor is ignored.
Note that initializeCursor is not exact; a deviation up to few seconds can occur.
6 - 100"42d-ago"
NB! This parameter requires an alpha header to use.
Properties to convert to another unit. The API can only convert to another unit, if a unit has been defined as part of the type on the underlying container being queried.
Use unitSystemName to convert all properties to the target unit system without
specifying each property individually.
NB! Unit conversion is applied to both the response and the request. For example, let's assume
there is a temperature property with its unit defined as temperature:deg_c. If
one requests conversion of this property to temperature:k unit,
then all values of this property in response will be converted to Kelvin.
But also all values of this property in request (e.g. in a filter)
are expected to be provided in Kelvin.
Show child attributes
NB! This parameter requires an alpha header to use.
If set to true, property type information will be included into response.
Only following properties are included:
items response parameter (for /filter and /sync responses)filter request parametertargetUnits request parameteraggregates request parameter (for /aggregate request )true
Limits the number of results to return.
1 <= x <= 100042
The next chunk of matching the filter records starting from the cursor in the request.
Note: The maximum total response size is 10MB.
List of records.
Show child attributes
A cursor to use in the next request as a starting point to get the next chunk of records.
"c29tZSBjdXJzb3I="
The attribute indicates if there are more records to read in the storage or the cursor points to the last item.
true
Property type information. This attribute is present only if
includeTyping was set to true in request.
Show child attributes
Was this page helpful?