设备接入 IOTDA-创建预调配模板:请求示例

时间:2024-06-28 09:24:33

请求示例

  • 创建预调配模板-参数引用

    POST https://{endpoint}/v5/iot/{project_id}/provisioning-templates
    
    {
      "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"
            },
            "tags" : [ {
              "tag_key" : {
                "ref" : "iotda::certificate::organization"
              },
              "tag_value" : {
                "ref" : "iotda::certificate::organizational_unit"
              }
            } ]
          },
          "policy" : {
            "policy_ids" : [ "5c90fa7d3c4e4405e8525079" ]
          }
        }
      }
    }
  • 创建预调配模板-部分参数自定义

    POST https://{endpoint}/v5/iot/{project_id}/provisioning-templates
    
    {
      "template_name" : "myTemplate2",
      "description" : "myTemplate2",
      "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" : "642bf260f2f9030e44210d8d",
            "tags" : [ {
              "tag_key" : "myTagKey",
              "tag_value" : "myTagValue"
            } ]
          },
          "policy" : {
            "policy_ids" : [ "5c90fa7d3c4e4405e8525079" ]
          }
        }
      }
    }
support.huaweicloud.com/api-iothub/CreateProvisioningTemplate.html