Share via


DigitalTwinsClient.CreateOrReplaceRelationship<T> Method

Definition

Creates a relationship on a digital twin synchronously. If the provided relationship Id is already in use, this will attempt to replace the existing relationship with the provided relationship.

public virtual Azure.Response<T> CreateOrReplaceRelationship<T> (string digitalTwinId, string relationshipId, T relationship, Azure.ETag? ifNoneMatch = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrReplaceRelationship : string * string * 'T * Nullable<Azure.ETag> * System.Threading.CancellationToken -> Azure.Response<'T>
override this.CreateOrReplaceRelationship : string * string * 'T * Nullable<Azure.ETag> * System.Threading.CancellationToken -> Azure.Response<'T>
Public Overridable Function CreateOrReplaceRelationship(Of T) (digitalTwinId As String, relationshipId As String, relationship As T, Optional ifNoneMatch As Nullable(Of ETag) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Response(Of T)

Type Parameters

T

The type to deserialize the relationship to.

Parameters

digitalTwinId
String

The Id of the source digital twin.

relationshipId
String

The Id of the relationship to delete.

relationship
T

The application/json relationship to be created.

ifNoneMatch
Nullable<ETag>

If-None-Match header that makes the request method conditional on a recipient cache or origin server either not having any current representation of the target resource. For more information about this property, see RFC 7232. Acceptable values are null or "". If ifNonMatch option is null the service will replace the existing entity with the new entity. If ifNoneMatch option is "" (or All) the service will reject the request if the entity already exists. An optional ETag to only make the request if the value does not match on the service.

cancellationToken
CancellationToken

The cancellation token.

Returns

The HTTP response Response<T>.

Exceptions

The exception that captures the errors from the service. Check the ErrorCode and Status properties for more details.

The exception is thrown when digitalTwinId or relationshipId is null.

Remarks

Relationships are a one-way link from a source digital twin to another, as described at creation time of the assigned model of the digital twin.

For more samples, see our repo samples.

Applies to

See also