DigitalTwinsClient.CreateOrReplaceDigitalTwin<T> Method

Definition

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

public virtual Azure.Response<T> CreateOrReplaceDigitalTwin<T> (string digitalTwinId, T digitalTwin, Azure.ETag? ifNoneMatch = default, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateOrReplaceDigitalTwin : string * 'T * Nullable<Azure.ETag> * System.Threading.CancellationToken -> Azure.Response<'T>
override this.CreateOrReplaceDigitalTwin : string * 'T * Nullable<Azure.ETag> * System.Threading.CancellationToken -> Azure.Response<'T>
Public Overridable Function CreateOrReplaceDigitalTwin(Of T) (digitalTwinId As String, digitalTwin 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 digital twin to.

Parameters

digitalTwinId
System.String

The Id of the digital twin.

digitalTwin
T

The application/json digital twin to create.

ifNoneMatch
System.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
System.Threading.CancellationToken

The cancellation token.

Returns

Response<T>

The created application/json digital twin and the http response Response<T>.

Exceptions

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

Remarks

For more samples, see our repo samples.

Applies to