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",
"limit": 42
}
'{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"createdTime": 1720616232,
"lastUpdatedTime": 1720616232,
"status": "created",
"properties": {}
}
],
"nextCursor": "c29tZSBjdXJzb3I=",
"hasNext": true
}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",
"limit": 42
}
'{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"createdTime": 1720616232,
"lastUpdatedTime": 1720616232,
"status": "created",
"properties": {}
}
],
"nextCursor": "c29tZSBjdXJzb3I=",
"hasNext": true
}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"
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
Was this page helpful?