Query Pre-provisioning Template Details
Function
This API is used by an application to query details about a pre-provisioning template with a specified ID on the IoT platform.
Debugging
You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.
URI
GET /v5/iot/{project_id}/provisioning-templates/{template_id}
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Parameter description: project ID. For details about how to obtain the project ID, see Obtaining a Project ID. |
template_id |
Yes |
String |
Pre-provisioning template ID. |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
No |
String |
Parameter description: user token. Obtain the token by calling the IAM API for obtaining a user token through password authentication. In the returned response header, X-Subject-Token is the desired user token. For details about how to obtain the token, see Token Authentication. |
Instance-Id |
No |
String |
Parameter description: instance ID. Unique identifier of each instance in the physical multi-tenant scenario. Mandatory for professional editions and recommended in other cases. Log in to the IoTDA console and choose Overview in the navigation pane to view the instance ID. For details, see Viewing Instance Details. |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
template_id |
String |
Parameter description: ID of the pre-provisioning template. |
template_name |
String |
Parameter description: name of the pre-provisioning template. Value: The value can contain a maximum of 128 characters. Only letters, digits, underscores (_), and hyphens (-) are allowed. |
description |
String |
Parameter description: description of the pre-provisioning template. Value: The value can contain a maximum of 2,048 characters. Only letters, digits, and special characters (_?'#().,&%@!-) are allowed. Maximum: 2048 |
template_body |
ProvisioningTemplateBody object |
Parameter description: detailed content of the pre-provisioning template in JSON format. |
create_time |
String |
Time when a pre-provisioning template is created on the IoT platform. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. |
update_time |
String |
Time when the pre-provisioning template is updated in the IoT platform. The value is in the format of yyyyMMdd'T'HHmmss'Z', for example, 20151212T121212Z. |
Parameter |
Type |
Description |
---|---|---|
parameters |
Object |
Parameter description: pre-provisioning template parameters, which can be extracted from the user fields of pre-provisioning device certificates. The configuration format is {"parameter":{"type":"String"}}. Huawei Cloud IoT platform defines the parameters that can be declared and referenced in pre-provisioning templates. A device certificate must contain the parameters referenced in the template.
type indicates the parameter type. Currently, only String is supported. Configuration example: '{"iotda::certificate::country":{"type":"String"}, "iotda::certificate::organization":{"type":"String"}, "iotda::certificate::organizational_unit":{"type":"String"}, "iotda::certificate::distinguished_name_qualifier":{"type":"String"}, "iotda::certificate::state_name":{"type":"String"}, "iotda::certificate::common_name":{"type":"String"}, "iotda::certificate::serial_number":{"type":"String"}}' |
resources |
TemplateResource object |
Structure of device resources of a pre-provisioning template. |
Parameter |
Type |
Description |
---|---|---|
device |
DeviceResource object |
Structure of device resource details of a pre-provisioning template. |
policy |
PolicyResource object |
Structure of device policy resource details of a pre-provisioning template. |
Parameter |
Type |
Description |
---|---|---|
device_name |
ParameterRef object |
Device name. |
node_id |
ParameterRef object |
Node ID. |
product_id |
Object |
Parameter description: ID of the product to which the device belongs. The value can be a static string ID or dynamic parameters referenced from the template.
|
tags |
Array of TagRef objects |
Parameter description: list of tags bound to a device. |
Parameter |
Type |
Description |
---|---|---|
tag_key |
Object |
Parameter description: tag key name. The value can be a static string or dynamic parameters referenced from the template.
|
tag_value |
Object |
Parameter description: tag value. The value can be a static string or dynamic parameters referenced from the template.
|
Example Requests
Queries details about a pre-provisioning template with a specified ID.
GET https://{endpoint}/v5/iot/{project_id}/provisioning-templates/{template_id}
Example Responses
Status code: 200
OK
{ "template_id" : "5c90fa7d3c4e4405e8525079", "template_name" : "myTemplate", "description" : "myTemplate", "template_body" : { "parameters" : { "iotda::certificate::country" : { "type" : "String" }, "iotda::certificate::organization" : { "type" : "String" }, "iotda::certificate::organizational_unit" : { "type" : "String" }, "iotda::certificate::distinguished_name_qualifier" : { "type" : "String" }, "iotda::certificate::state_name" : { "type" : "String" }, "iotda::certificate::common_name" : { "type" : "String" }, "iotda::certificate::serial_number" : { "type" : "String" } }, "resources" : { "device" : { "device_name" : { "ref" : "iotda::certificate::organization" }, "node_id" : { "ref" : "iotda::certificate::common_name" }, "product_id" : { "ref" : "iotda::certificate::organization" } }, "policy" : { "policy_ids" : [ "5c90fa7d3c4e4405e8525079" ] } } }, "create_time" : "20230810T070547Z", "update_time" : "20230810T070547Z" }
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
404 |
Not Found |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot