Device Templates - Get

Hämta en enhetsmall kopplad till ett ID

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

URI-parametrar

Name I Obligatorisk Typ Description
baseDomain
path True

string

Basdomänen för alla Azure IoT Central-tjänstbegäranden.

deviceTemplateId
path True

string

Unik digital tvillingmodellidentifierare för enhetsmallen.

subdomain
path True

string

Programmets underdomän.

api-version
query True

string

Den version av API:et som anropas.

Svar

Name Typ Description
200 OK

DeviceTemplate

Klart

Other Status Codes

Error

Ett felsvar som tagits emot från IoT Central-tjänsten.

Headers

x-ms-error-code: string

Säkerhet

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 personifiera ditt användarkonto

Exempel

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

Definitioner

Name Description
DeviceTemplate

Enhetsmalldefinitionen.

Error

Definitionen av svarsfel.

ErrorDetails

Detaljerad information om felet.

DeviceTemplate

Enhetsmalldefinitionen.

Name Typ Description
@id

string

Unikt ID för enhetsmallen.

@type

string[]

JSON-LD-typerna för den här enhetsmallen.

capabilityModel

object

Kapacitetsmodellen som används av den här enhetsmallen.

description

string

Detaljerad beskrivning av enhetsmallen.

displayName

string

Enhetsmallens visningsnamn.

etag

string

ETag som används för att förhindra konflikter i uppdateringar av enhetsmallar.

Error

Definitionen av svarsfel.

Name Typ Description
error

ErrorDetails

Felinformation för aktuell begäran.

ErrorDetails

Detaljerad information om felet.

Name Typ Description
code

string

Felkod.

message

string

Information om felmeddelanden.

requestId

string

Korrelations-ID för aktuell begäran.

time

string

Den tid då felbegäran misslyckades.