更新时间:2022-07-13 GMT+08:00
分享

新建管道作业

功能介绍

新建管道作业时,需要在URL中指定是更新哪一个作业,将在body中附带完整的作业信息。(作业中各算子的详细配置请参考算子使用指南章节。) check参数表示是否需要对作业配置进行检查,若为false,则不检查,将作业保存为草稿;若为true,则对作业配置进行检查。当检查不通过时,将作业状态修改为草稿;检查通过时,将作业状态修改为就绪,并返回成功。

调试

您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。

URI

POST /v1/{project_id}/pipelines

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

项目ID

最小长度:1

最大长度:128

表2 Query参数

参数

是否必选

参数类型

描述

check

Boolean

是否需要校验配置是否正确

请求参数

表3 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

租户Token

最小长度:1

最大长度:65535

表4 请求Body参数

参数

是否必选

参数类型

描述

{自定义key}

Object

pipelineName:作业名称;pipelineDescription:作业描述;pipelineType:支持API、IDE、IOTDA_API类型。管道作业详细配置(管道作业详细配置,每个作业可选择不同的算子进行组合,各算子的使用方法详见:数据管道算子使用指南。)

响应参数

状态码: 201

表5 响应Body参数

参数

参数类型

描述

pipeline_id

String

管道ID

最小长度:1

最大长度:100

check_info

Map<String,Object>

管道校验错误详情,若为空,则说明管道校验成功,否则,需要修改管道配置,校验成功(即该字段内容为空)后,才可启动。

状态码: 400

表6 响应Body参数

参数

参数类型

描述

error_code

String

错误码

最小长度:1

最大长度:100

error_msg

String

错误消息

最小长度:0

最大长度:1024

状态码: 401

表7 响应Body参数

参数

参数类型

描述

error_code

String

错误码

最小长度:1

最大长度:100

error_msg

String

错误消息

最小长度:0

最大长度:1024

状态码: 403

表8 响应Body参数

参数

参数类型

描述

error_code

String

错误码

最小长度:1

最大长度:100

error_msg

String

错误消息

最小长度:0

最大长度:1024

状态码: 500

表9 响应Body参数

参数

参数类型

描述

error_code

String

错误码

最小长度:1

最大长度:100

error_msg

String

错误消息

最小长度:0

最大长度:1024

请求示例

{
  "definition" : {
    "pipelineName" : "SMT设备告警处理",
    "pipelineType" : "IDE",
    "pipelineDescription" : ""
  },
  "operatorInstances" : [ {
    "id" : "operator0",
    "className" : "IoTDASource",
    "point" : {
      "x" : -180,
      "y" : -38
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "IoTDA",
        "dataSourceId" : "5f36de9032393fb3ffc8c043",
        "eventTime" : {
          "jsonPath" : "body.event_time",
          "pattern" : "yyyyMMdd'T'HHmmss'Z'"
        }
      },
      "advanceConfigs" : {
        "assignerWithPeriodicWatermarksType" : "BoundedOutOfOrdernessTimestampExtractor",
        "maxOutOfOrdernessInSeconds" : 300,
        "isSplitServices" : "FALSE",
        "startup" : {
          "startupMode" : "LATEST"
        }
      },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/DEVICE_MSG_V2",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553"
      }
    },
    "fromOperators" : [ ]
  }, {
    "id" : "operator1",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : -178
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "AOI1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de439aa3bcc02c02aa547"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator2",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : -178
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "AOI1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "AOI1",
          "dataStoreId" : "2a1c168c-524d-4323-a65c-91bfef190704",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "2a1c168c-524d-4323-a65c-91bfef190704"
      }
    },
    "fromOperators" : [ {
      "id" : "operator1"
    } ]
  }, {
    "id" : "operator3",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : -122
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "Mounter1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de417aa3bcc02c02aa4f6"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator4",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : -122
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "Mounter1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "Mounter1",
          "dataStoreId" : "0ba0a7cd-da5f-4a49-afd7-49147a2ca949",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "0ba0a7cd-da5f-4a49-afd7-49147a2ca949"
      }
    },
    "fromOperators" : [ {
      "id" : "operator3"
    } ]
  }, {
    "id" : "operator5",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : -66
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "HDCLaserMarking1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de465a6467502c0597655"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator6",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : -66
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "HDCLaserMarking1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "LaserMarking1",
          "dataStoreId" : "ef6eacfc-aaf8-4576-83f6-a89282af6874",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "ef6eacfc-aaf8-4576-83f6-a89282af6874"
      }
    },
    "fromOperators" : [ {
      "id" : "operator5"
    } ]
  }, {
    "id" : "operator7",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : -10
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "SPI1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de459a6467502c059763b"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator8",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : -10
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "SPI1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "SPI1",
          "dataStoreId" : "b20ed1b6-610d-46b0-a89a-f3643df98ce3",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "b20ed1b6-610d-46b0-a89a-f3643df98ce3"
      }
    },
    "fromOperators" : [ {
      "id" : "operator7"
    } ]
  }, {
    "id" : "operator9",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : 46
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "Printing1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de472a6467502c0597679"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator10",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : 46
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "Printing1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "Printing1",
          "dataStoreId" : "a6c6cd6a-1954-480b-ac28-6e8f9a2ab45d",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "a6c6cd6a-1954-480b-ac28-6e8f9a2ab45d"
      }
    },
    "fromOperators" : [ {
      "id" : "operator9"
    } ]
  }, {
    "id" : "operator11",
    "className" : "ProductFilter",
    "point" : {
      "x" : 80,
      "y" : 102
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "RefluxFurnace1产品",
        "appId" : "BUeiGOT6GZfdRurw9gDl9qiQtoIa",
        "productId" : "609de42aaa3bcc02c02aa522"
      },
      "advanceConfigs" : { }
    },
    "fromOperators" : [ {
      "id" : "operator0"
    } ]
  }, {
    "id" : "operator12",
    "className" : "DataStoreSink",
    "point" : {
      "x" : 340,
      "y" : 102
    },
    "configs" : {
      "basicConfigs" : {
        "name" : "RefluxFurnace1产品的数据输出",
        "dataStore" : {
          "dataStoreName" : "RefluxFurnace1",
          "dataStoreId" : "07969c42-3fd4-4b20-bdb2-69408a6bdc18",
          "dataStoreGroupId" : "d28b479d-2c09-46de-bb02-411e5c6f6c80",
          "dataStoreProperty" : {
            "properties" : [ {
              "name" : "AlarmTime",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmTime",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmType",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmType",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "DeviceID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.DeviceID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmDesc",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmDesc",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmID",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmID",
              "tag" : "FALSE",
              "unit" : ""
            }, {
              "name" : "AlarmName",
              "type" : "STRING",
              "existingProperty" : "body.content.content.AlarmName",
              "tag" : "FALSE",
              "unit" : ""
            } ],
            "deviceId" : "header.device_id"
          },
          "dataStoreGroupName" : "SMT-Demo-Storage"
        }
      },
      "advanceConfigs" : { },
      "systemConfigs" : {
        "serviceUrl" : "pulsar+ssl://172.27.224.2:36651",
        "topicName" : "07d7cc195b8025e72ffcc01b1021e553/default/PIPELINE_DEVICE_MSG",
        "userProjectId" : "07d7cc195b8025e72ffcc01b1021e553",
        "dataStoreId" : "07969c42-3fd4-4b20-bdb2-69408a6bdc18"
      }
    },
    "fromOperators" : [ {
      "id" : "operator11"
    } ]
  } ]
}

响应示例

状态码: 201

Created

{
  "pipeline_id" : "string",
  "check_info" : { }
}

状态码

状态码

描述

201

Created

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

405

Method Not Allowed

409

Conflict

500

Internal Server Error

错误码

请参见错误码

相关文档