digital_twin_models
Creates, updates, deletes, gets or lists a digital_twin_models resource.
Overview
| Name | digital_twin_models |
| Type | Resource |
| Id | azure.digital_twins_core.digital_twin_models |
Fields
The following fields are returned by SELECT queries:
- get_by_id
- list
| Name | Datatype | Description |
|---|---|---|
id | string | The id of the model as specified in the model definition. Required. |
decommissioned | boolean | Indicates if the model is decommissioned. Decommissioned models cannot be referenced by newly created digital twins. |
description | object | A language map that contains the localized descriptions as specified in the model definition. |
displayName | object | A language map that contains the localized display names as specified in the model definition. |
model | object | The model definition. |
uploadTime | string (date-time) | The time the model was uploaded to the service. |
| Name | Datatype | Description |
|---|---|---|
id | string | The id of the model as specified in the model definition. Required. |
decommissioned | boolean | Indicates if the model is decommissioned. Decommissioned models cannot be referenced by newly created digital twins. |
description | object | A language map that contains the localized descriptions as specified in the model definition. |
displayName | object | A language map that contains the localized display names as specified in the model definition. |
model | object | The model definition. |
uploadTime | string (date-time) | The time the model was uploaded to the service. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_by_id | select | id, endpoint | traceparent, tracestate, includeModelDefinition | Retrieves model metadata and optionally the model definition. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The model id is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found. |
list | select | endpoint | traceparent, tracestate, includeModelDefinition, max-items-per-page | Retrieves model metadata and, optionally, model definitions. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The model id is invalid. * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached. * 404 Not Found * ModelNotFound - The model was not found. |
update | update | id, endpoint | traceparent, tracestate | Updates the metadata for a model. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The model id is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found. * 409 Conflict * ModelReferencesNotDecommissioned - The model refers to models that are not decommissioned. |
delete | delete | id, endpoint | traceparent, tracestate | Deletes a model. A model can only be deleted if no other models reference it. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The model id is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found. * 409 Conflict * ModelReferencesNotDeleted - The model refers to models that are not deleted. |
add | exec | endpoint | traceparent, tracestate | Uploads one or more models. When any error occurs, no models are uploaded. Status codes: * 201 Created * 400 Bad Request * DTDLParserError - The models provided are not valid DTDL. * InvalidArgument - The model id is invalid. * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached. * ModelVersionNotSupported - The version of DTDL used is not supported. * 409 Conflict * ModelAlreadyExists - The model provided already exists. |
Parameters
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
endpoint | string | The service endpoint host (no scheme). (default: ) |
id | string | The id for the model. The id is globally unique and case sensitive. Required. |
includeModelDefinition | boolean | When true the model definition will be returned as part of the result. Default value is False. |
max-items-per-page | integer | |
traceparent | string | |
tracestate | string |
SELECT examples
- get_by_id
- list
Retrieves model metadata and optionally the model definition. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The model id is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found.
SELECT
id,
decommissioned,
description,
displayName,
model,
uploadTime
FROM azure.digital_twins_core.digital_twin_models
WHERE id = '{{ id }}' -- required
AND endpoint = '{{ endpoint }}' -- required
AND traceparent = '{{ traceparent }}'
AND tracestate = '{{ tracestate }}'
AND includeModelDefinition = '{{ includeModelDefinition }}'
;
Retrieves model metadata and, optionally, model definitions. Status codes: * 200 OK * 400 Bad Request * InvalidArgument - The model id is invalid. * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached. * 404 Not Found * ModelNotFound - The model was not found.
SELECT
id,
decommissioned,
description,
displayName,
model,
uploadTime
FROM azure.digital_twins_core.digital_twin_models
WHERE endpoint = '{{ endpoint }}' -- required
AND traceparent = '{{ traceparent }}'
AND tracestate = '{{ tracestate }}'
AND includeModelDefinition = '{{ includeModelDefinition }}'
AND max-items-per-page = '{{ max-items-per-page }}'
;
UPDATE examples
- update
Updates the metadata for a model. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The model id is invalid. * JsonPatchInvalid - The JSON Patch provided is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found. * 409 Conflict * ModelReferencesNotDecommissioned - The model refers to models that are not decommissioned.
UPDATE azure.digital_twins_core.digital_twin_models
SET
traceparent = '{{ traceparent }}',
tracestate = '{{ tracestate }}'
WHERE
id = '{{ id }}' --required
AND endpoint = '{{ endpoint }}' --required
AND traceparent = '{{ traceparent}}'
AND tracestate = '{{ tracestate}}';
DELETE examples
- delete
Deletes a model. A model can only be deleted if no other models reference it. Status codes: * 204 No Content * 400 Bad Request * InvalidArgument - The model id is invalid. * MissingArgument - The model id was not provided. * 404 Not Found * ModelNotFound - The model was not found. * 409 Conflict * ModelReferencesNotDeleted - The model refers to models that are not deleted.
DELETE FROM azure.digital_twins_core.digital_twin_models
WHERE id = '{{ id }}' --required
AND endpoint = '{{ endpoint }}' --required
AND traceparent = '{{ traceparent }}'
AND tracestate = '{{ tracestate }}'
;
Lifecycle Methods
- add
Uploads one or more models. When any error occurs, no models are uploaded. Status codes: * 201 Created * 400 Bad Request * DTDLParserError - The models provided are not valid DTDL. * InvalidArgument - The model id is invalid. * LimitExceeded - The maximum number of model ids allowed in 'dependenciesFor' has been reached. * ModelVersionNotSupported - The version of DTDL used is not supported. * 409 Conflict * ModelAlreadyExists - The model provided already exists.
EXEC azure.digital_twins_core.digital_twin_models.add
@endpoint='{{ endpoint }}' --required,
@traceparent='{{ traceparent }}',
@tracestate='{{ tracestate }}'
@@json=
'{
"traceparent": "{{ traceparent }}",
"tracestate": "{{ tracestate }}"
}'
;