<entry>The id of the task to create the attachment for.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<emphasisrole="bold">Request body:</emphasis>
The request should be of type <literal>multipart/form-data</literal>. There should be a single file-part included with the binary value of the variable. On top of that, the folowing additionl form-fields can be present:
<itemizedlist>
<listitem>
<para><literal>name</literal>: Required name of the variable.</para>
</listitem>
<listitem>
<para><literal>description</literal>: Description of the attachment, optional.</para>
</listitem>
<listitem>
<para><literal>type</literal>: Type of attachment, optional. Supports any arbitrary string or a valid HTTP content-type.</para>
<entry>Indicates the attachment was created and the result is returned.</entry>
</row>
<row>
<entry>400</entry>
<entry>Indicates the attachment name is missing from the request or no file was present in the request. The error-message contains additional information.</entry>
</row>
<row>
<entry>404</entry>
<entry>Indicates the requested task was not found.</entry>
<literal>externalUrl - contentUrl:</literal>In case the attachment is a link to an external resource, the <literal>externalUrl</literal> contains the URL to the external content. If the attachment content is present in the
Activiti engine, the <literal>contentUrl</literal> will contain an URL where the binary content can be streamed from.
</para>
</listitem>
<listitem>
<para>
<literal>type:</literal>Can be any arbitrary value. When a valid formatted media-type (eg. application/xml, text/plain) is included, the binary content HTTP response content-type will be set the the given value.
</para>
</listitem>
</itemizedlist>
</para>
<para>
<table>
<title>Response codes</title>
<tgroupcols='2'>
<thead>
<row>
<entry>Response code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>200</entry>
<entry>Indicates the task and attachment were found and the attachment is returned.</entry>
</row>
<row>
<entry>404</entry>
<entry>Indicates the requested task was not found or the tasks doesn't have a attachment with the given ID.</entry>
<entry>The id of the task to get a variable data for.</entry>
</row>
<row>
<entry>attachmentId</entry>
<entry>Yes</entry>
<entry>String</entry>
<entry>The id of the attachment, a <literal>404</literal> is returned when the attachment points to an external URL rather than content attached in Activiti.</entry>
</row>
</tbody>
</tgroup>
</table>
</para>
<para>
<table>
<title>Response codes</title>
<tgroupcols='2'>
<thead>
<row>
<entry>Response code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>200</entry>
<entry>Indicates the task and attachment was found and the requested content is returned.</entry>
</row>
<row>
<entry>404</entry>
<entry>Indicates the requested task was not found or the task doesn't have an attachment with the given id or the attachment doesn't have a binary stream available. Status message provides additional information.</entry>
The response body contains the binary content. By default, the content-type of the response is set to <literal>application/octet-stream</literal> unless the attachment type contains a valid Content-type.
</para>
</section>
<section>
<title>Delete a single attachment on a task</title>