Device Templates - Get

Get a device template by ID

GET https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-version=2022-07-31

URI Parameters

Name In Required Type Description
baseDomain
path True

string

The base domain for all Azure IoT Central service requests.

deviceTemplateId
path True

string

Unique Digital Twin Model Identifier of the device template.

subdomain
path True

string

The application subdomain.

api-version
query True

string

The version of the API being called.

Responses

Name Type Description
200 OK

DeviceTemplate

Success

Other Status Codes

Error

An error response received from the IoT Central Service.

Headers

x-ms-error-code: string

Security

azure_auth

Azure Active Directory OAuth2 Flow

Type: oauth2
Flow: implicit
Authorization URL: https://login.microsoftonline.com/common/oauth2/authorize

Scopes

Name Description
user_impersonation impersonate your user account

Examples

Get a device template by ID

Sample Request

GET https://appsubdomain.azureiotcentral.com/api/deviceTemplates/dtmi:contoso:testDeviceTemplate;1?api-version=2022-07-31

Sample Response

{
  "etag": "\"~FeoA18iSWEoC7QR3Xf33BmlVQoXvM6toNHamHuGdBs8=\"",
  "displayName": "Test Contoso Definition",
  "capabilityModel": {
    "@id": "dtmi:contoso:testCapabilityModel;1",
    "@type": "Interface",
    "contents": [
      {
        "@id": "dtmi:contoso:testCapabilityModel:settings;1",
        "@type": "Component",
        "displayName": "Settings",
        "name": "settings",
        "schema": {
          "@id": "dtmi:contoso:settings;1",
          "@type": "Interface",
          "contents": [
            {
              "@type": "Telemetry",
              "displayName": "Test Component Telemetry",
              "name": "testComponentTelemetry",
              "schema": "double"
            },
            {
              "@type": [
                "Property",
                "Initialized"
              ],
              "displayName": "Temperature Threshold",
              "name": "threshold",
              "schema": "double",
              "writable": true,
              "initialValue": "100"
            }
          ],
          "displayName": "Settings"
        }
      },
      {
        "@type": [
          "Telemetry",
          "Humidity"
        ],
        "displayName": "Humidity",
        "name": "humidity",
        "schema": "double"
      },
      {
        "@type": [
          "Property",
          "Cloud"
        ],
        "displayName": "Online Status",
        "name": "status",
        "schema": {
          "@type": "Enum",
          "enumValues": [
            {
              "displayName": "Offline",
              "enumValue": 1,
              "name": "offline"
            },
            {
              "displayName": "Online",
              "enumValue": 2,
              "name": "online"
            }
          ],
          "valueSchema": "integer"
        }
      }
    ],
    "displayName": "Test Capability Model",
    "extends": [
      {
        "@id": "dtmi:contoso:testInterface;1",
        "@type": [
          "Interface",
          "NamedInterface"
        ],
        "contents": [
          {
            "@type": "Telemetry",
            "displayName": "Test Telemetry",
            "name": "testTelemetry",
            "schema": "double"
          },
          {
            "@type": [
              "EventValue",
              "Telemetry",
              "Event"
            ],
            "displayName": "Test Event",
            "name": "testEvent",
            "schema": "integer",
            "severity": "warning"
          },
          {
            "@type": [
              "Initialized",
              "Property"
            ],
            "displayName": "Test Property",
            "name": "testProperty",
            "schema": "string",
            "writable": true,
            "initialValue": "initialValue1"
          },
          {
            "@type": "Property",
            "displayName": "Test Read-Only Property",
            "name": "testReadOnly",
            "schema": "string"
          },
          {
            "@type": "Property",
            "displayName": "Test Complex Property",
            "name": "testComplex",
            "schema": {
              "@id": "dtmi:contoso:testComplex;1",
              "@type": "Object",
              "displayName": "Object",
              "fields": [
                {
                  "displayName": "First",
                  "name": "first",
                  "schema": "string"
                },
                {
                  "displayName": "Second",
                  "name": "second",
                  "schema": "string"
                }
              ]
            },
            "writable": true
          },
          {
            "@type": "Command",
            "commandType": "synchronous",
            "displayName": "Test Command",
            "name": "testCommand",
            "request": {
              "@type": "CommandPayload",
              "displayName": "Test Request",
              "name": "testRequest",
              "schema": "double"
            },
            "response": {
              "@type": "CommandPayload",
              "displayName": "Test Response",
              "name": "testResponse",
              "schema": "geopoint"
            }
          },
          {
            "@type": "Property",
            "displayName": "Test Enum",
            "name": "testEnum",
            "schema": {
              "@id": "dtmi:contoso:testEnum;1",
              "@type": "Enum",
              "displayName": "Enum",
              "enumValues": [
                {
                  "displayName": "First",
                  "enumValue": 1,
                  "name": "first"
                },
                {
                  "displayName": "Second",
                  "enumValue": 2,
                  "name": "second"
                }
              ],
              "valueSchema": "integer"
            },
            "writable": true
          }
        ],
        "displayName": "Test Interface",
        "name": "contoso_testInterface"
      }
    ]
  },
  "@id": "dtmi:modelDefinition:contoso;1",
  "@type": [
    "ModelDefinition",
    "DeviceModel"
  ]
}

Definitions

Name Description
DeviceTemplate

The device template definition.

Error

The response error definition.

ErrorDetails

The detail information of the error.

DeviceTemplate

The device template definition.

Name Type Description
@id

string

Unique ID of the device template.

@type

string[]

The JSON-LD types of this device template.

capabilityModel

object

The capability model utilized by this device template.

description

string

Detailed description of the device template.

displayName

string

Display name of the device template.

etag

string

ETag used to prevent conflict in device template updates.

Error

The response error definition.

Name Type Description
error

ErrorDetails

Error details for current request.

ErrorDetails

The detail information of the error.

Name Type Description
code

string

Error code.

message

string

Error message details.

requestId

string

Correlation Id for current request.

time

string

The time that error request failed.