Device Templates - Update
Update the cloud properties and overrides of an existing device template via patch.
PATCH https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-version=2022-07-31
URI Parameters
Name | In | Required | Type | Description |
---|---|---|---|---|
base
|
path | True |
string |
The base domain for all Azure IoT Central service requests. |
device
|
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. |
Request Body
Media Types: "application/json", "application/merge-patch+json"
Name | Type | Description |
---|---|---|
body |
object |
Device template patch body. |
Responses
Name | Type | Description |
---|---|---|
200 OK |
Success |
|
Other Status Codes |
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
Update a device template
Sample request
PATCH https://appsubdomain.azureiotcentral.com/api/deviceTemplates/dtmi:contoso:testDeviceTemplate;1?api-version=2022-07-31
{
"displayName": "Test Definition Update",
"@type": [
"ModelDefinition",
"DeviceModel"
],
"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": [
"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"
}
}
Sample response
{
"etag": "\"~FeoA18iSWEoC7QR3Xf33BmlVQoXvM6toNHamHuGdBs8=\"",
"displayName": "Test Definition Update",
"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": [
"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"
},
"@id": "dtmi:modelDefinition:contoso;1",
"@type": [
"ModelDefinition",
"DeviceModel"
]
}
Definitions
Name | Description |
---|---|
Device |
The device template definition. |
Error |
The response error definition. |
Error |
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 |
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. |