Skip to main content

digital_twins

Creates, updates, deletes, gets or lists a digital_twins resource.

Overview

Namedigital_twins
TypeResource
Idazure.digital_twins_core.digital_twins

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
$relationshipIdstringA user-provided string representing the id of this relationship, unique in the context of the source digital twin, i.e. sourceId + relationshipId is unique in the context of the service.
$relationshipLinkstringLink to the relationship, to be used for deletion.
$relationshipNamestringThe name of the relationship.
$sourceIdstringThe id of the source digital twin.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_incoming_relationshipsselectid, endpointtraceparent, tracestateRetrieves all incoming relationship for a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.
updateupdateid, endpointtraceparent, tracestate, If-MatchUpdates a digital twin. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id or payload is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * ValidationFailed - Applying the patch results in an invalid digital twin. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
deletedeleteid, endpointtraceparent, tracestate, If-MatchDeletes a digital twin. All relationships referencing the digital twin must already be deleted. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * RelationshipsNotDeleted - The digital twin contains relationships. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
list_relationshipsexecid, endpointtraceparent, tracestate, relationshipNameRetrieves the relationships from a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.
get_by_idexecid, endpointtraceparent, tracestateRetrieves a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.
addexecid, endpointtraceparent, tracestate, If-None-MatchAdds or replaces a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id or payload is invalid. * ModelDecommissioned - The model for the digital twin is decommissioned. * TwinLimitReached - The maximum number of digital twins allowed has been reached. * ValidationFailed - The digital twin payload is not valid. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
get_relationship_by_idexecid, relationship_id, endpointtraceparent, tracestateRetrieves a relationship between two digital twins. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id or relationship id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * RelationshipNotFound - The relationship was not found.
add_relationshipexecid, relationship_id, endpointtraceparent, tracestate, If-None-MatchAdds a relationship between two digital twins. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id, relationship id, or payload is invalid. * InvalidRelationship - The relationship is invalid. * OperationNotAllowed - The relationship cannot connect to the same digital twin. * ValidationFailed - The relationship content is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * TargetTwinNotFound - The digital twin target of the relationship was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
delete_relationshipexecid, relationship_id, endpointtraceparent, tracestate, If-MatchDeletes a relationship between two digital twins. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id or relationship id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * RelationshipNotFound - The relationship was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
update_relationshipexecid, relationship_id, endpointtraceparent, tracestate, If-MatchUpdates the properties on a relationship between two digital twins. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id or relationship id is invalid. * InvalidRelationship - The relationship is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * ValidationFailed - The relationship content is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * RelationshipNotFound - The relationship was not found. * 409 Conflict * RelationshipAlreadyExists - The relationship already exists. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
get_componentexecid, component_path, endpointtraceparent, tracestateRetrieves a component from a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id or component path is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * ComponentNotFound - The component path was not found.
update_componentexecid, component_path, endpointtraceparent, tracestate, If-MatchUpdates a component on a digital twin. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id, component path, or payload is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * ValidationFailed - Applying the patch results in an invalid digital twin. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.
send_telemetryexecid, Message-Id, endpointtraceparent, tracestate, Telemetry-Source-TimeSends telemetry on behalf of a digital twin. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id or message id is invalid. * ValidationFailed - The telemetry content is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.
send_component_telemetryexecid, component_path, Message-Id, endpointtraceparent, tracestate, Telemetry-Source-TimeSends telemetry on behalf of a component in a digital twin. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id, message id, or component path is invalid. * ValidationFailed - The telemetry content is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * ComponentNotFound - The component path was not found.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
Message-IdstringA unique message identifier (in the scope of the digital twin id) that is commonly used for de-duplicating messages. Required.
component_pathstringThe name of the DTDL component. Required.
endpointstringThe service endpoint host (no scheme). (default: )
idstringThe id of the digital twin. The id is unique within the service and case sensitive. Required.
relationship_idstringThe id of the relationship. The id is unique within the digital twin and case sensitive. Required.
If-Matchstring
If-None-Matchstring
Telemetry-Source-TimestringAn RFC 3339 timestamp that identifies the time the telemetry was measured. Default value is None.
relationshipNamestringThe name of the relationship. Default value is None.
traceparentstring
tracestatestring

SELECT examples

Retrieves all incoming relationship for a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.

SELECT
$relationshipId,
$relationshipLink,
$relationshipName,
$sourceId
FROM azure.digital_twins_core.digital_twins
WHERE id = '{{ id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND traceparent = '{{ traceparent }}'
AND tracestate = '{{ tracestate }}'
;

UPDATE examples

Updates a digital twin. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id or payload is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * ValidationFailed - Applying the patch results in an invalid digital twin. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.

UPDATE azure.digital_twins_core.digital_twins
SET
traceparent = '{{ traceparent }}',
tracestate = '{{ tracestate }}',
If-Match = '{{ If-Match }}'
WHERE
id = '{{ id }}' --required
AND endpoint = '{{ endpoint }}' --required
AND traceparent = '{{ traceparent}}'
AND tracestate = '{{ tracestate}}'
AND If-Match = '{{ If-Match}}';

DELETE examples

Deletes a digital twin. All relationships referencing the digital twin must already be deleted. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * RelationshipsNotDeleted - The digital twin contains relationships. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found. * 412 Precondition Failed * PreconditionFailed - The precondition check (If-Match or If-None-Match) failed.

DELETE FROM azure.digital_twins_core.digital_twins
WHERE id = '{{ id }}' --required
AND endpoint = '{{ endpoint }}' --required
AND traceparent = '{{ traceparent }}'
AND tracestate = '{{ tracestate }}'
AND If-Match = '{{ If-Match }}'
;

Lifecycle Methods

Retrieves the relationships from a digital twin. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The digital twin id is invalid. * 404 Not Found * DigitalTwinNotFound - The digital twin was not found.

EXEC azure.digital_twins_core.digital_twins.list_relationships 
@id='{{ id }}' --required,
@endpoint='{{ endpoint }}' --required,
@traceparent='{{ traceparent }}',
@tracestate='{{ tracestate }}',
@relationshipName='{{ relationshipName }}'
@@json=
'{
"traceparent": "{{ traceparent }}",
"tracestate": "{{ tracestate }}"
}'
;