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

  1. ------------------------------925df49a954b
  2. Content-Disposition: form-data; name="url"
  3. http://my-attachment-content-url.de
  4. ------------------------------925df49a954b
  5. Content-Disposition: form-data; name="attachment-name"
  6. attachmentName
  7. ------------------------------925df49a954b
  8. Content-Disposition: form-data; name="attachment-description"
  9. attachmentDescription
  10. ------------------------------925df49a954b
  11. Content-Disposition: form-data; name="attachment-type"
  12. attachmentType
  13. ------------------------------925df49a954b--

Response

Status 200.

  1. {
  2. "links": [
  3. {
  4. "method": "GET",
  5. "href": "http://localhost:38080/rest-test/task/aTaskId/attachment/aTaskAttachmentId",
  6. "rel": "self"
  7. }
  8. ],
  9. "id": "attachmentId",
  10. "name": "attachmentName",
  11. "taskId": "aTaskId",
  12. "description": "attachmentDescription",
  13. "type": "attachmentType",
  14. "url": "http://my-attachment-content-url.de"
  15. }

原文: https://docs.camunda.org/manual/7.9/reference/rest/task/attachment/post-task-attachment/