Device Templates - List

Dapatkan daftar templat perangkat dalam aplikasi dengan dukungan ODATA dasar ($top, $filter, $orderby), detail selengkapnya.

GET https://{subdomain}.{baseDomain}/api/deviceTemplates?api-version=2022-06-30-preview
GET https://{subdomain}.{baseDomain}/api/deviceTemplates?api-version=2022-06-30-preview&$filter={$filter}&$top={$top}&$orderby={$orderby}

Parameter URI

Name In Required Type Description
baseDomain
path True
  • string

Domain dasar untuk semua permintaan layanan Azure IoT Central.

subdomain
path True
  • string

Subdomain aplikasi.

api-version
query True
  • string

Versi API yang dipanggil.

$filter
query
  • string

Ekspresi pada jenis sumber daya yang memilih sumber daya yang akan dikembalikan.

$orderby
query
  • string

Ekspresi yang menentukan urutan sumber daya yang dikembalikan.

$top
query
  • integer

Jumlah maksimum sumber daya yang akan dikembalikan dari koleksi.

Respons

Name Type Description
200 OK

Berhasil

Other Status Codes

Respons kesalahan diterima dari IoT Central Service.

Headers

  • x-ms-error-code: string

Keamanan

azure_auth

Alur OAuth2 Azure Active Directory

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

Scopes

Name Description
user_impersonation meniru akun pengguna Anda

Contoh

List device templates

Sample Request

GET https://appsubdomain.azureiotcentral.com/api/deviceTemplates?api-version=2022-06-30-preview

Sample Response

{
  "value": [
    {
      "@id": "dtmi:contoso:testDeviceTemplate;1",
      "@type": [
        "ModelDefinition",
        "DeviceModel",
        "EdgeModel"
      ],
      "displayName": "Test Definition",
      "etag": "\"~jbzfGhYctc9wtzNZXVmVua5JjTHO/FfjMUJvk9hqkRY=\"",
      "capabilityModel": {
        "@id": "dtmi:contoso:testCapabilityModel;1",
        "@type": "Interface",
        "displayName": "Test Capability Model",
        "extends": [
          {
            "@id": "dtmi:contoso:testInterface;1",
            "@type": "Interface",
            "displayName": "Test Interface",
            "contents": [
              {
                "@type": "Telemetry",
                "displayName": "Test Telemetry",
                "name": "testTelemetry",
                "schema": "double"
              },
              {
                "@type": [
                  "Telemetry",
                  "Event",
                  "EventValue"
                ],
                "displayName": "Test Event",
                "name": "testEvent",
                "schema": "integer",
                "severity": "warning"
              },
              {
                "@type": [
                  "Property",
                  "Initialized"
                ],
                "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": {
                  "displayName": "Test Request",
                  "name": "testRequest",
                  "schema": "double"
                },
                "response": {
                  "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
              }
            ]
          }
        ],
        "contents": [
          {
            "@type": [
              "Relationship",
              "EdgeModule"
            ],
            "displayName": "Test Module",
            "maxMultiplicity": 1,
            "name": "testModule",
            "target": [
              {
                "@id": "dtmi:contoso:testModuleCapabilityModel;1",
                "@type": "Interface",
                "displayName": "Test Module Capability Model",
                "extends": [
                  {
                    "@id": "dtmi:contoso:testModuleInterface;1",
                    "@type": "Interface",
                    "contents": [
                      {
                        "@type": "Telemetry",
                        "displayName": "Test Module Telemetry",
                        "name": "testModuleTelemetry",
                        "schema": "double"
                      },
                      {
                        "@type": "Property",
                        "displayName": "Test Module Property",
                        "name": "testModuleProperty",
                        "schema": "string",
                        "writable": true
                      }
                    ],
                    "displayName": "Test Module Interface"
                  }
                ]
              }
            ]
          },
          {
            "@type": [
              "Cloud",
              "Property"
            ],
            "displayName": "Test Cloud Property",
            "name": "testCloudProperty",
            "schema": "dateTime"
          }
        ]
      },
      "deploymentManifest": {
        "modulesContent": {
          "$edgeAgent": {
            "properties.desired": {
              "schemaVersion": "1.1",
              "runtime": {
                "type": "docker",
                "settings": {
                  "minDockerVersion": "v1.25",
                  "loggingOptions": "",
                  "registryCredentials": {
                    "ContosoRegistry": {
                      "username": "myacr",
                      "password": "<password>",
                      "address": "myacr.azurecr.io"
                    }
                  }
                }
              },
              "systemModules": {
                "edgeAgent": {
                  "type": "docker",
                  "settings": {
                    "image": "mcr.microsoft.com/azureiotedge-agent:1.1",
                    "createOptions": "{}"
                  }
                },
                "edgeHub": {
                  "type": "docker",
                  "status": "running",
                  "restartPolicy": "always",
                  "startupOrder": 0,
                  "settings": {
                    "image": "mcr.microsoft.com/azureiotedge-hub:1.1",
                    "createOptions": "{\"HostConfig\":{\"PortBindings\":{\"443/tcp\":[{\"HostPort\":\"443\"}],\"5671/tcp\":[{\"HostPort\":\"5671\"}],\"8883/tcp\":[{\"HostPort\":\"8883\"}]}}}"
                  }
                }
              },
              "modules": {
                "SimulatedTemperatureSensor": {
                  "version": "1.0",
                  "type": "docker",
                  "status": "running",
                  "restartPolicy": "always",
                  "startupOrder": 2,
                  "settings": {
                    "image": "mcr.microsoft.com/azureiotedge-simulated-temperature-sensor:1.0",
                    "createOptions": "{}"
                  }
                },
                "testModule": {
                  "version": "1.0",
                  "type": "docker",
                  "status": "running",
                  "restartPolicy": "always",
                  "startupOrder": 1,
                  "env": {
                    "tempLimit": {
                      "value": "100"
                    }
                  },
                  "settings": {
                    "image": "myacr.azurecr.io/testModule:latest",
                    "createOptions": "{}"
                  }
                }
              }
            }
          },
          "$edgeHub": {
            "properties.desired": {
              "schemaVersion": "1.1",
              "routes": {
                "sensorToFilter": {
                  "route": "FROM /messages/modules/SimulatedTemperatureSensor/outputs/temperatureOutput INTO BrokeredEndpoint(\"/modules/testModule/inputs/input1\")",
                  "priority": 0,
                  "timeToLiveSecs": 1800
                },
                "filterToIoTHub": {
                  "route": "FROM /messages/modules/testModule/outputs/output1 INTO $upstream",
                  "priority": 1,
                  "timeToLiveSecs": 1800
                }
              },
              "storeAndForwardConfiguration": {
                "timeToLiveSecs": 100
              }
            }
          }
        }
      }
    }
  ]
}

Definisi

DeviceTemplate

Definisi templat perangkat.

DeviceTemplateCollection

Hasil halaman templat perangkat.

Error

Definisi kesalahan respons.

ErrorDetails

Informasi detail kesalahan.

DeviceTemplate

Definisi templat perangkat.

Name Type Description
@id
  • string

ID unik templat perangkat.

@type
  • string[]

Jenis JSON-LD dari templat perangkat ini.

capabilityModel
  • object

Model kemampuan yang digunakan oleh templat perangkat ini.

deploymentManifest
  • object

Manifes penyebaran yang terkait dengan templat perangkat ini.

description
  • string

Deskripsi terperinci tentang templat perangkat.

displayName
  • string

Nama tampilan templat perangkat.

etag
  • string

ETag digunakan untuk mencegah konflik dalam pembaruan templat perangkat.

DeviceTemplateCollection

Hasil halaman templat perangkat.

Name Type Description
nextLink
  • string

URL untuk mendapatkan halaman templat perangkat berikutnya.

value

Kumpulan templat perangkat.

Error

Definisi kesalahan respons.

Name Type Description
error

Detail kesalahan untuk permintaan saat ini.

ErrorDetails

Informasi detail kesalahan.

Name Type Description
code
  • string

Kode Kesalahan.

message
  • string

Detail pesan kesalahan.

requestId
  • string

Id Korelasi untuk permintaan saat ini.

time
  • string

Waktu permintaan kesalahan gagal.