rel = client.relationships.retrieve(external_id="flow1")
rel.confidence = 0.75
res = client.relationships.update(rel)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").source_external_id.set("alternate_source").confidence.set(0.97)
res1 = client.relationships.update(my_update)
another_update = RelationshipUpdate(external_id="flow_1").confidence.set(None)
res2 = client.relationships.update(another_update)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").labels.add(["PUMP", "VERIFIED"])
res = client.relationships.update(my_update)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").labels.remove("PUMP")
res = client.relationships.update(my_update)
{
"items": [
{
"externalId": "<string>",
"sourceExternalId": "<string>",
"sourceType": "asset",
"targetExternalId": "<string>",
"targetType": "asset",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"startTime": 1730204346000,
"endTime": 1730204346000,
"confidence": 0.5,
"dataSetId": 4503599627370496,
"labels": [
{
"externalId": "my.known.id"
}
]
}
]
}Required capabilities:
relationshipsAcl:WRITErelationshipsAcl:READ
Update relationships between resources according to the partial definitions of the relationships given in the payload of the request. This means that fields not mentioned in the payload will remain unchanged. Up to 1000 relationships can be updated in one operation.
To delete a value from an optional value the setNull field should be set to true.
The order of the updated relationships in the response equals the order in the request.
rel = client.relationships.retrieve(external_id="flow1")
rel.confidence = 0.75
res = client.relationships.update(rel)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").source_external_id.set("alternate_source").confidence.set(0.97)
res1 = client.relationships.update(my_update)
another_update = RelationshipUpdate(external_id="flow_1").confidence.set(None)
res2 = client.relationships.update(another_update)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").labels.add(["PUMP", "VERIFIED"])
res = client.relationships.update(my_update)
from cognite.client.data_classes import RelationshipUpdate
my_update = RelationshipUpdate(external_id="flow_1").labels.remove("PUMP")
res = client.relationships.update(my_update)
{
"items": [
{
"externalId": "<string>",
"sourceExternalId": "<string>",
"sourceType": "asset",
"targetExternalId": "<string>",
"targetType": "asset",
"createdTime": 1730204346000,
"lastUpdatedTime": 1730204346000,
"startTime": 1730204346000,
"endTime": 1730204346000,
"confidence": 0.5,
"dataSetId": 4503599627370496,
"labels": [
{
"externalId": "my.known.id"
}
]
}
]
}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.
Data required to update relationships.
1 - 1000 elementsShow child attributes
Relationships stored by CDF.
1 - 1000 elementsShow child attributes
Was this page helpful?