Creates an attachment for a task.
Method
POST /task/{id}/attachment/create
Parameters
Path Parameters
Name | Description |
---|---|
id | The id of the task to add the attachment to. |
Request Body
A multipart form submit with the following parts:
Form Part Name | Content Type | Description |
---|---|---|
attachment-name | text/plain | The name of the attachment. |
attachment-description | text/plain | The description of the attachment. |
attachment-type | text/plain | The type of the attachment. |
url | text/plain | The url to the remote content of the attachment. |
content | text/plain | The content of the attachment. |
Result
A JSON object corresponding to the Attachment
interface in the engine.Its properties are as follows:
Name | Value | Description |
---|---|---|
id | String | The id of the task attachment. |
name | String | The name of the task attachment. |
taskId | String | The id of the task to which the attachment belongs. |
description | String | The description of the task attachment. |
type | String | Indication of the type of content that this attachment refers to. Can be MIME type or any other indication. |
url | String | The url to the remote content of the task attachment. |
Response codes
Code | Media type | Description |
---|---|---|
200 | application/json | Request successful. |
400 | application/json | The task does not exists or task id is null. No content or url to remote content exists. See the Introduction for the error response format. |
403 | application/json | The history of the engine is disabled. See the Introduction for the error response format. |
Example
Request
Post data for a new task attachment:
POST /task/aTaskId/attachment/create
------------------------------925df49a954b
Content-Disposition: form-data; name="url"
http://my-attachment-content-url.de
------------------------------925df49a954b
Content-Disposition: form-data; name="attachment-name"
attachmentName
------------------------------925df49a954b
Content-Disposition: form-data; name="attachment-description"
attachmentDescription
------------------------------925df49a954b
Content-Disposition: form-data; name="attachment-type"
attachmentType
------------------------------925df49a954b--
Response
Status 200.
{
"links": [
{
"method": "GET",
"href": "http://localhost:38080/rest-test/task/aTaskId/attachment/aTaskAttachmentId",
"rel": "self"
}
],
"id": "attachmentId",
"name": "attachmentName",
"taskId": "aTaskId",
"description": "attachmentDescription",
"type": "attachmentType",
"url": "http://my-attachment-content-url.de"
}
原文: https://docs.camunda.org/manual/7.9/reference/rest/task/attachment/post-task-attachment/