0
点赞
收藏
分享

微信扫一扫

Flowable入门系列文章139 - 任务 13

祈澈菇凉 2022-02-07 阅读 47
java

1、在任务上创建新的附件,其中包含指向外部资源的链接

表1.在任务上创建新的附件,其中包含指向外部资源的链接 - URL参数

参数需要描述
任务id创建附件的任务的ID。

请求正文:

{
"name":"Simple attachment",
"description":"Simple attachment description",
"type":"simpleType",
"externalUrl":"http://flowable.org"
}

只有附件名称是需要创建一个新的附件。

成功回应机构:

{
"id":"3",
"url":"http://localhost:8182/runtime/tasks/2/attachments/3",
"name":"Simple attachment",
"description":"Simple attachment description",
"type":"simpleType",
"taskUrl":"http://localhost:8182/runtime/tasks/2",
"processInstanceUrl":null,
"externalUrl":"http://flowable.org",
"contentUrl":null
}

表2.在任务上创建新的附件,其中包含指向外部资源的链接 - 响应代码

响应码描述
201指示附件已创建并返回结果。
400表示请求中缺少附件名称。
404表示找不到请求的任务。

2、在任务上创建一个新的附件,附带一个附件

表3.在一个任务上创建一个新的附件,附带一个文件–URL参数

参数需要描述
任务id创建附件的任务的ID。

请求正文:
该请求应该是类型的multipart/form-data。变量的二进制值应该包含一个文件部分。最重要的是,可以存在以下附加的表单字段:

  • name:变量的必需名称。
  • description:附件说明,可选。
  • type:附件类型,可选。支持任意字符串或有效的HTTP内容类型。

成功回应机构:

{
"id":"5",
"url":"http://localhost:8182/runtime/tasks/2/attachments/5",
"name":"Binary attachment",
"description":"Binary attachment description",
"type":"binaryType",
"taskUrl":"http://localhost:8182/runtime/tasks/2",
"processInstanceUrl":null,
"externalUrl":null,
"contentUrl":"http://localhost:8182/runtime/tasks/2/attachments/5/content"
}

表4.使用附加文件 - 响应代码在任务上创建新附件

响应码描述
201指示附件已创建并返回结果。
400表示请求中缺少附件名称,或者请求中没有文件。错误消息包含其他信息。
404表示找不到请求的任务。
举报

相关推荐

0 条评论