Models - DigitalTwinModels List

Retrieves model metadata and, optionally, model definitions. Status codes:

  • 200 OK
  • 400 Bad Request
    • InvalidArgument - The model id is invalid.
    • LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached.
  • 404 Not Found
    • ModelNotFound - The model was not found.
GET https://digitaltwins-hostname/models?api-version=2023-10-31
GET https://digitaltwins-hostname/models?dependenciesFor={dependenciesFor}&includeModelDefinition={includeModelDefinition}&api-version=2023-10-31

URI Parameters

Name In Required Type Description
api-version
query True

string

The requested API version.

dependenciesFor
query

string[]

If specified, only return the set of the specified models along with their dependencies. If omitted, all models are retrieved.

includeModelDefinition
query

boolean

When true the model definition will be returned as part of the result.

Request Header

Name Required Type Description
max-items-per-page

integer

The maximum number of items to retrieve per request. The server may choose to return less than the requested number.

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

PagedDigitalTwinsModelDataCollection

Success

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

List models
List models (include dependencies and definitions)

List models

Sample Request

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

Sample Response

{
  "value": [
    {
      "id": "dtmi:com:example:Sample;1",
      "uploadTime": "2022-02-28T00:30:00.1234567Z",
      "decommissioned": false
    },
    {
      "id": "dtmi:com:example:SampleDeviceModel;1",
      "displayName": {
        "en": "My Device Model"
      },
      "uploadTime": "2022-02-27T00:30:00.1234567Z",
      "decommissioned": false
    },
    {
      "id": "dtmi:com:example:AnotherSample;1",
      "displayName": {
        "en": "My Sample"
      },
      "uploadTime": "2022-02-26T00:30:00.1234567Z",
      "decommissioned": false
    }
  ],
  "nextLink": "url-to-next-page"
}

List models (include dependencies and definitions)

Sample Request

GET https://digitaltwins-hostname/models?dependenciesFor=dtmi:com:example:SampleDeviceModel;1&includeModelDefinition=True&api-version=2023-10-31

Sample Response

{
  "value": [
    {
      "id": "dtmi:com:example:Sample;1",
      "uploadTime": "2022-02-28T00:30:00.1234567Z",
      "decommissioned": false,
      "model": {
        "@id": "dtmi:com:example:Sample;1",
        "@type": "Interface",
        "contents": [
          {
            "@type": "Property",
            "name": "name",
            "displayName": "Sample instance name",
            "schema": "string"
          },
          {
            "@type": "Property",
            "name": "temp",
            "displayName": "Sample instance temperature",
            "schema": "integer"
          },
          {
            "@type": "Property",
            "name": "comfortIndex",
            "displayName": "Sample instance comfort index",
            "schema": "integer"
          }
        ],
        "@context": "dtmi:dtdl:context;2"
      }
    },
    {
      "id": "dtmi:com:example:SampleDeviceModel;1",
      "displayName": {
        "en": "My Device Model"
      },
      "uploadTime": "2022-02-28T00:30:00.1234567Z",
      "decommissioned": false,
      "model": {
        "@id": "dtmi:com:example:SampleDeviceModel;1",
        "@type": "Interface",
        "displayName": "My Device Model",
        "contents": [
          {
            "@type": "Component",
            "name": "Sample",
            "schema": "dtmi:com:example:Sample;1"
          }
        ],
        "@context": "dtmi:dtdl:context;2"
      }
    }
  ],
  "nextLink": "url-to-next-page"
}

Definitions

Name Description
DigitalTwinsModelData

A model definition and metadata for that model.

Error

Error definition.

ErrorResponse

Error response.

InnerError

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

PagedDigitalTwinsModelDataCollection

A collection of DigitalTwinsModelData objects.

DigitalTwinsModelData

A model definition and metadata for that model.

Name Type Default Value Description
decommissioned

boolean

False

Indicates if the model is decommissioned. Decommissioned models cannot be referenced by newly created digital twins.

description

object

A language map that contains the localized descriptions as specified in the model definition.

displayName

object

A language map that contains the localized display names as specified in the model definition.

id

string

The id of the model as specified in the model definition.

model

object

The model definition.

uploadTime

string

The time the model was uploaded to the service.

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.

PagedDigitalTwinsModelDataCollection

A collection of DigitalTwinsModelData objects.

Name Type Description
nextLink

string

A URI to retrieve the next page of objects.

value

DigitalTwinsModelData[]

The DigitalTwinsModelData objects.