You can create and update instances using GraphQL. The mutation capabilities available from the GraphQL API represent a subset of the capabilities of the ingestion REST API endpoints. The GraphQL interface for data modeling doesn’t anticipate receiving significant data ingestion traffic. For that, please use the DMS REST API, or the CDF Transformations service. For a data model like the example below, mutations are generated for each type, except types annotated with theDocumentation Index
Fetch the complete documentation index at: https://docs.cognite.com/llms.txt
Use this file to discover all available pages before exploring further.
@edge directive:
upsert mutations
The mutations receive a list of instances you want to create for a specific type. For example:
node and edge. Direct relations only require node.
node includes the fields for the target type, while edge include the fields for the connecting edge. The edge could contain properties, if an edge type is defined in the model, or could be simply space and externalId. It’s similar for direct relations, though only node should be included, no edge.
A more complex example could look like this:
-
Properties
externalIdspacecreatedTimelastUpdatedTimewasModified: aBooleanto specify whether an existing instance was modified or a new instance was created, or an instance was unchanged.instanceType:nodeoredgeversion
-
Parameters
items: a list of the instances to upsert. This has the shape of the type being upserted. Any nested items have thenodefield to contain the properties of the target type. Relations also have theedgefield to contain edge properties.