Create or update nodes and edges in a transaction. The items
field of the payload is an array of objects
where each object describes a node or an edge to create, patch or replace. The instanceType
field of
each object must be node
or edge
and determines how the rest of the object is interpreted.
This operation is currently limited to 1000 nodes and/or edges at a time.
Individual nodes and edges are uniquely identified by their externalId and space.
For more details on ingesting instances into a graph, see [Ingesting instances] (https://docs.cognite.com/cdf/dm/dm_concepts/dm_ingestion).
When there is no node or edge with the given externalId in the given space, a node will be created and the
properties provided for each of the containers or views in the sources
array will be populated for the
node/edge. Nodes can also be created implicitly when an edge between them is created (if
autoCreateStartNodes
and/or autoCreateEndNodes
is set), or when a direct relation
property is set, the target node does not exist and autoCreateDirectRelations
is set.
To add a node or edge, the user must have capabilities to access (write to) both the view(s) referenced in
sources
and the container(s) underlying these views, as well as any directly referenced containers.
When a node or edge (instance) with the given externalId already exists in a space, the
properties named in the sources
field will be written to the instance. Other properties will remain
unchanged. To replace the whole set of properties for an instance (a node or an edge) rather than patch the
instance, set the replace
parameter to true
.
Note: When using replace
as true
it will replace any omitted property to either it's default
value as defined on the container(s) or null if no default value is set. All properties on the related
container(s) referenced in the provided sources
view(s) will be replaced, so even when the provided
view(s) only contains a subset of properties from a container all the properties in that container for that
instance will be replaced. If the underlying container(s) have any required properties that are not provided,
the operation will fail.
If you use a writable view to update properties (that is, the source you are referring to in sources
is a view), you must have write access to the view as well as all of its backing containers.
When a node/edge item has no changes compared to the existing instance - that is, when the supplied property
values are equal to the corresponding values in the existing node/edge, the node/edge will stay unchanged.
In this case, the lastUpdatedTime
values for the nodes/edges in question will not change.
Nodes/edges to add or update.
Created or updated nodes and edges
The response for a failed request.
Ingestion conflict
{- "items": [
- {
- "instanceType": "node",
- "existingVersion": 0,
- "space": "string",
- "externalId": "string",
- "type": {
- "space": "string",
- "externalId": "string"
}, - "sources": [
- {
- "source": {
- "type": "view",
- "space": "string",
- "externalId": "string",
- "version": "string"
}, - "properties": {
- "someStringProperty": "someStringValue",
- "someDirectRelation": {
- "space": "mySpace",
- "externalId": "someNode"
}, - "someIntArrayProperty": [
- 1,
- 2,
- 3,
- 4
]
}
}
]
}
], - "autoCreateDirectRelations": true,
- "autoCreateStartNodes": false,
- "autoCreateEndNodes": false,
- "skipOnVersionConflict": false,
- "replace": false
}
{- "items": [
- {
- "instanceType": "node",
- "version": 0,
- "wasModified": true,
- "space": "string",
- "externalId": "string",
- "createdTime": 1730204346000,
- "lastUpdatedTime": 1730204346000
}
]
}