Freigeben über


Twins - DigitalTwins GetById

Retrieves 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 https://digitaltwins-hostname/digitaltwins/{id}?api-version=2023-10-31

URI Parameters

Name In Required Type Description
id
path True

string

The id of the digital twin. The id is unique within the service and case sensitive.

api-version
query True

string

The requested API version.

Request Header

Name Required Type Description
traceparent

string

Identifies the request in a distributed tracing system.

tracestate

string

Provides vendor-specific trace identification information and is a companion to traceparent.

Responses

Name Type Description
200 OK

DigitalTwin

Success

Headers

ETag: string

Other Status Codes

ErrorResponse

Default response.

Headers

x-ms-error-code: string

Security

oauth2

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize?resource=0b07f429-9f4b-4714-9392-cc5e8e80c8b0

Examples

Get a digital twin by id

Sample request

GET https://digitaltwins-hostname/digitaltwins/myTwinId?api-version=2023-10-31

Sample response

{
  "$dtId": "myTwinId",
  "$etag": "W/\"9c2876c2-aff0-40b3-9fba-0c6be9d020a6\"",
  "property1": 1,
  "property2": {
    "subProperty1": "some value",
    "subProperty2": "some other value"
  },
  "component1": {
    "componentProperty": "some value",
    "$metadata": {
      "$lastUpdateTime": "2022-02-28T00:30:00.1234567Z",
      "componentProperty": {
        "lastUpdateTime": "2022-02-28T00:30:00.1234567Z"
      }
    }
  },
  "$metadata": {
    "$model": "dtmi:com:example:interfaces:interfaceName;1",
    "$lastUpdateTime": "2022-02-28T00:30:00.1234567Z",
    "property1": {
      "lastUpdateTime": "2022-02-28T00:30:00.1234567Z"
    },
    "property2": {
      "lastUpdateTime": "2022-02-28T00:30:00.1234567Z"
    }
  }
}

Definitions

Name Description
Error

Error definition.

ErrorResponse

Error response.

InnerError

A more specific error description than was provided by the containing error.

Error

Error definition.

Name Type Description
code

string

Service specific error code which serves as the substatus for the HTTP error code.

details

Error[]

Internal error details.

innererror

InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

ErrorResponse

Error response.

Name Type Description
error

Error

The error details.

InnerError

A more specific error description than was provided by the containing error.

Name Type Description
code

string

A more specific error code than was provided by the containing error.

innererror

InnerError

An object containing more specific information than the current object about the error.