Skip to content

Commit d699d0d

Browse files
committed
changes after review
1 parent 2f9e2ba commit d699d0d

File tree

2 files changed

+11
-23
lines changed

2 files changed

+11
-23
lines changed

articles/iot-central/core/howto-manage-device-templates-with-rest-api.md

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,17 @@ services: iot-central
1212

1313
# How to use the IoT Central REST API to manage device templates
1414

15-
The IoT Central REST API lets you develop client applications that integrate with IoT Central applications. You can use the REST API to manage device templates in your IoT Central application.
15+
The IoT Central REST API lets you develop client applications that integrate with IoT Central applications. You can use the REST API to manage [device templates](concepts-device-templates.md) in your IoT Central application.
1616

1717
Every IoT Central REST API call requires an authorization header. To learn more, see [How to authenticate and authorize IoT Central REST API calls](howto-authorize-rest-api.md).
1818

1919
For the reference documentation for the IoT Central REST API, see [Azure IoT Central REST API reference](/rest/api/iotcentral/).
2020

2121
## Device templates
2222

23-
Any device that's connected to and managed by an IoT Central application is associated with a device template in the application. The device model in the template acts as a contract between the IoT Central application and the devices connected to it. The device template also includes information about how IoT Central displays information about the device in the web UI. For example, a device template can include definitions of dashboards to show device telemetry or to send commands to a device.
23+
A device template contains a device model, cloud property definitions, customizations, and view definitions. The REST API lets you manage the device model, cloud property definitions, and customizations. Use the UI to create and manage views.
2424

25-
The device model section of a device template specifies the capabilities of a device you want to connect to your application. For example, a device template can specify:
26-
27-
* The types of telemetry, such as temperature, that your device sends to IoT Central
28-
* Properties, such as firmware version, that your device will report to IoT Central.
29-
* Properties, such as target temperature, that IoT Central will set on your device.
30-
* Commands, such as reboot, that IoT Central will send to your device.
31-
32-
The capabilities in a device model are grouped into interfaces. Interfaces enable you to share groups of related capabilities across templates. For example, the common Device Information interface defines device properties such as the manufacturer, model, and software version.
33-
34-
Device templates includes _cloud properties_ which specifies any device metadata to store. Cloud properties are never synchronized with devices and only exist in the application. It also includes _customizations_, they can override some of the definitions in the device model. Customizations are useful if you want to refine how the application handles a value, such as changing the display name for a property or the color used to display a telemetry value. However, you cannot add _views_ from the API, it can be added only through the UI.
25+
The device model section of a device template specifies the capabilities of a device you want to connect to your application. Capabilities include telemetry, properties, and commands. The model is defined using [DTDL](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md).
3526

3627
## Device templates REST API
3728

@@ -45,7 +36,7 @@ The IoT Central REST API lets you:
4536

4637
### Add a device template
4738

48-
Use the following request to publish a new device template. Default views will be automatically generated for new device templates created this way.
39+
Use the following request to create and publish a new device template. Default views are automatically generated for device templates created this way.
4940

5041
```http
5142
PUT https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-version=1.0
@@ -54,7 +45,7 @@ PUT https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-
5445
>[!NOTE]
5546
>Device template IDs follow the [DTDL](https://github.com/Azure/opendigitaltwins-dtdl/blob/master/DTDL/v2/dtdlv2.md#digital-twin-model-identifier) naming convention, for example: `dtmi:contoso:mythermostattemplate;1`
5647
57-
The sample request body looks like the following example:
48+
The following example shows a request body that adds a device template for a thermostat device. The `capabilityModel` includes temperature telemetry, two properties, and a command. The device template defines the `CustomerName` cloud property and customizes the `targetTemperature` property with `decimalPlaces`, `displayUnit`, `maxValue`, and `minValue`. The value of the device template `@id` must match the `deviceTemplateId` value in the URL. The value of the device template `@id` is not the same as the value of the `capabilityModel` `@id` value.
5849

5950
```json
6051
{
@@ -176,7 +167,7 @@ The sample request body looks like the following example:
176167
}
177168
```
178169

179-
Request body some required fields:
170+
The request body has some required fields:
180171

181172
* `@id`: a unique ID in the form of a simple Uniform Resource Name.
182173
* `@type`: declares that this object is an interface.
@@ -323,6 +314,9 @@ Use the following request to retrieve details of a device template from your app
323314
GET https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-version=1.0
324315
```
325316

317+
>[!NOTE]
318+
> You can get the `deviceTemplateId` from IoT Central Application UI by hovering the mouse over a device.
319+
326320
The response to this request looks like the following example:
327321

328322
```json
@@ -708,7 +702,7 @@ PATCH https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?ap
708702
>[!NOTE]
709703
>`{deviceTemplateId}` should be the same as the `@id` in the payload.
710704
711-
The sample request body looks like the following example which adds a new cloud property:
705+
The sample request body looks like the following example which adds a the `LastMaintenanceDate` cloud property to the device template:
712706

713707
```json
714708
{
@@ -981,12 +975,6 @@ Use the following request to delete a device template:
981975
DELETE https://{subdomain}.{baseDomain}/api/deviceTemplates/{deviceTemplateId}?api-version=1.0
982976
```
983977

984-
The sample request looks like the following example:
985-
986-
```http
987-
DELETE https://appsubdomain.azureiotcentral.com/api/deviceTemplates/dtmi:contoso:testDeviceTemplate;1?api-version=1.0
988-
```
989-
990978
## Next steps
991979

992980
Now that you've learned how to manage device templates with the REST API, a suggested next step is to [How to create device templates from IoT Central GUI.](howto-set-up-template.md#create-a-device-template)

articles/iot-central/core/howto-manage-users-roles-with-rest-api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,4 +229,4 @@ DELETE https://{your app subdomain}.azureiotcentral.com/api/users/user-001?api-v
229229

230230
## Next steps
231231

232-
Now that you've learned how to manage users and roles with the REST API, a suggested next step is to [How to use the IoT Central REST API to control devices](howto-control-devices-with-rest-api.md).
232+
Now that you've learned how to manage users and roles with the REST API, a suggested next step is to [How to use the IoT Central REST API to manage device templates](howto-manage-device-templates-with-rest-api.md).

0 commit comments

Comments
 (0)