DigitalTwinsClient.GetDigitalTwin<T>(String, CancellationToken) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets a digital twin synchronously.
public virtual Azure.Response<T> GetDigitalTwin<T> (string digitalTwinId, System.Threading.CancellationToken cancellationToken = default);
abstract member GetDigitalTwin : string * System.Threading.CancellationToken -> Azure.Response<'T>
override this.GetDigitalTwin : string * System.Threading.CancellationToken -> Azure.Response<'T>
Public Overridable Function GetDigitalTwin(Of T) (digitalTwinId As String, Optional cancellationToken As CancellationToken = Nothing) As Response(Of T)
Type Parameters
- T
The type to deserialize the digital twin to.
Parameters
- digitalTwinId
- String
The Id of the digital twin.
- cancellationToken
- CancellationToken
The cancellation token.
Returns
The deserialized 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.
The exception is thrown when digitalTwinId
is null
.
Remarks
A strongly typed object type such as BasicDigitalTwin can be used as a generic type for T
to indicate what type is used to deserialize the response value. It may also be deserialized into custom digital twin types that extend the BasicDigitalTwin with additional strongly typed properties provided that you know the definition of the retrieved digital twin prior to deserialization.
For more samples, see our repo samples.