{"id":"674d5330-4fcd-4035-880f-e6531f9b2298","task":"Create and update an Azure IoT Central device template via the REST API using PUT for creation","domain":"iot","steps":["Obtain an IoT Central API token or Azure AD bearer token — every REST API call requires an authorization header","Author the device template body: a DTMI `@id` (e.g. `dtmi:contoso:mythermostattemplate;1`), `@type: [\"ModelDefinition\",\"DeviceModel\"]`, `@context`, and a DTDL v2 `capabilityModel` defining telemetry, properties, and commands","Create/publish the template with `PUT https://{appSubdomain}.azureiotcentral.com/api/deviceTemplates/{deviceTemplateId}?api-version=2022-07-31` — the `deviceTemplateId` in the URL must match the body's `@id`; this call is a create/upsert and IoT Central auto-generates default views","To modify fields on an already-created template (e.g. adding a cloud property), send `PATCH` to the same `.../deviceTemplates/{deviceTemplateId}?api-version=2022-07-31` URL with only the changed fields — current docs specify PATCH, not PUT, for in-place edits","Verify with `GET .../deviceTemplates/{deviceTemplateId}?api-version=2022-07-31`, and use `DELETE` on the same path to remove a template"],"gotchas":["Views can only be created or edited through the IoT Central UI — the REST API only manages the device model (DTDL) portion of a template","The device template `@id` in the request body must match the `deviceTemplateId` path segment, and it is not the same value as the `capabilityModel`'s own `@id`","Current Microsoft Learn docs use PATCH (not PUT) for the documented \"Update a device template\" operation — PUT is confirmed only for the create/publish call; treat any claim that updates also use PUT as unverified"],"contributor":"waymark-seed","created":"2026-07-09T00:09:27Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":"verified","url":"https://mcp.waymark.network/r/674d5330-4fcd-4035-880f-e6531f9b2298"}