curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/streams/{streamId}/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"sources": [
{
"source": {
"type": "container,",
"space": "mySpace,",
"externalId": "myContainer"
},
"properties": {
"someStringProperty": "someStringValue",
"someDirectRelation": {
"space": "mySpace",
"externalId": "someNode"
},
"someIntArrayProperty": [
1,
2,
3,
4
]
}
}
]
}
]
}
'{}Required capabilities:
StreamRecordsAcl:WRITEDataModelsAcl:READ
Before a user can add records, all referenced schema elements (Spaces, Containers, Properties) must be defined/created in Data Modeling
To add records, the user must have capabilities to access (read) the referenced containers as well as capabilities to access (write) the referenced record space.
Batches of records are ingested into a stream.
Under normal ingestion operation, and where the data stream does not contain any duplicated records,
the record will be created, and the properties defined in each of the containers in the sources array will be populated.
For immutable streams a duplicate record is defined as one which is being written to the same space,
which uses the same container definitions in the sources array,
and all the properties (names and values) are the same.
For immutable streams under most circumstances, when duplicate records are encountered during ingestion, the duplicate is discarded. However there are rare occasions when certain internal database operations occur, a duplicate may be stored.
For mutable streams duplicated record identifiers (space + externalId) are not allowed
and a request which tries to create a record with existing identifier will be rejected.
Note: The maximum total request size is 10MB.
curl --request POST \
--url https://{cluster}.cognitedata.com/api/v1/projects/{project}/streams/{streamId}/records \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"items": [
{
"space": "mySpace",
"externalId": "some_id",
"sources": [
{
"source": {
"type": "container,",
"space": "mySpace,",
"externalId": "myContainer"
},
"properties": {
"someStringProperty": "someStringValue",
"someDirectRelation": {
"space": "mySpace",
"externalId": "someNode"
},
"someIntArrayProperty": [
1,
2,
3,
4
]
}
}
]
}
]
}
'{}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"
Records to ingest into a stream.
List of records to write.
1 - 1000 elementsShow child attributes
An empty response is returned if all records from the request are successfully accepted to be created or updated.
Empty JSON object indicates all records are successfully accepted.
Was this page helpful?