Device Templates - Get

Získat šablonu zařízení podle ID

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

Parametry identifikátoru URI

Name V Vyžadováno Typ Description
baseDomain
path True

string

Základní doména pro všechny žádosti o službu Azure IoT Central

deviceTemplateId
path True

string

Jedinečný identifikátor modelu Digital Twin šablony zařízení.

subdomain
path True

string

Subdoména aplikace.

api-version
query True

string

Verze rozhraní API, která se volá.

Odpovědi

Name Typ Description
200 OK

DeviceTemplate

Success

Other Status Codes

Error

Ze služby IoT Central byla přijata chybová odpověď.

Headers

x-ms-error-code: string

Zabezpečení

azure_auth

Tok Azure Active Directory OAuth2

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

Scopes

Name Description
user_impersonation zosobnění uživatelského účtu

Příklady

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"
  ]
}

Definice

Name Description
DeviceTemplate

Definice šablony zařízení

Error

Definice chyby odpovědi.

ErrorDetails

Podrobné informace o chybě

DeviceTemplate

Definice šablony zařízení

Name Typ Description
@id

string

Jedinečné ID šablony zařízení.

@type

string[]

Typy JSON-LD této šablony zařízení.

capabilityModel

object

Model schopností, který tato šablona zařízení využívá.

description

string

Podrobný popis šablony zařízení

displayName

string

Zobrazovaný název šablony zařízení

etag

string

Značka ETag používaná k zabránění konfliktům v aktualizacích šablon zařízení.

Error

Definice chyby odpovědi.

Name Typ Description
error

ErrorDetails

Podrobnosti o chybě pro aktuální požadavek

ErrorDetails

Podrobné informace o chybě

Name Typ Description
code

string

Kód chyby

message

string

Podrobnosti o chybové zprávě

requestId

string

ID korelace pro aktuální požadavek

time

string

Čas, kdy žádost o chybu selhala.