IOT边缘 IOTEDGE-添加数采模板:请求示例

时间:2024-06-20 17:14:28

请求示例

GET https://{endpoint}/v2/{project_id}/templates/ots/data-sources

{
  "tpl_id" : "sys_general_opcua",
  "name" : "sys_general_opcua",
  "description" : "通用opcua模板",
  "datasource_meta" : {
    "config_tabs" : [ {
      "key" : "connection_info",
      "name" : "连接信息",
      "description" : "连接信息",
      "config_items" : [ {
        "key" : "endpoint",
        "name" : "服务端点",
        "description" : "服务完整URL",
        "data_type" : "string",
        "required" : true,
        "crypted" : false,
        "max_length" : 128,
        "example" : "opc.tcp://127.0.0.1:53530/OPCUA"
      }, {
        "key" : "username",
        "name" : "用户名",
        "description" : "OPCUA服务器认证用户名",
        "data_type" : "string",
        "required" : false,
        "crypted" : false,
        "max_length" : 128,
        "example" : "admin"
      }, {
        "key" : "password",
        "name" : "密码",
        "description" : "OPCUA服务器认证密码",
        "data_type" : "string",
        "required" : false,
        "crypted" : true,
        "max_length" : 512,
        "example" : "******"
      } ]
    }, {
      "key" : "collection_paras",
      "name" : "连接附加参数",
      "description" : "连接附加参数",
      "config_items" : [ {
        "key" : "default_cycle",
        "name" : "采集周期",
        "description" : "采集周期",
        "data_type" : "int",
        "required" : true,
        "crypted" : false,
        "max_length" : 65535,
        "example" : 10000
      } ]
    } ],
    "default_values" : {
      "drivername" : "OPCUA"
    }
  },
  "point_meta" : {
    "config_items" : [ {
      "key" : "address",
      "name" : "点位地址",
      "description" : "采集点位的地址",
      "data_type" : "string",
      "required" : true,
      "crypted" : false,
      "max_length" : 256,
      "example" : "ns=2;s=Root/Motor/Voltage"
    }, {
      "key" : "data_type",
      "name" : "点位值的数据类型",
      "description" : "点位地址存储值的数据类型",
      "data_type" : "string",
      "required" : true,
      "crypted" : false,
      "max_length" : 128,
      "example" : "int,decimal"
    }, {
      "key" : "cycle",
      "name" : "点位采集周期",
      "description" : "点位采集周期",
      "data_type" : "int",
      "required" : true,
      "crypted" : false,
      "max_length" : 65535,
      "example" : 10000
    } ]
  }
}
support.huaweicloud.com/api-iotedge/AddOtTemplates.html