Attach File to an Issue
POST /issue/{issue}/attachment
Attach file to issue
POST /rest/issue/{issue}/attachment?{group}&{name}&{authorLogin}&{created}&{files}
Parameters:
Name | Type | Description |
---|---|---|
issue | issue id | Issue id to attach files to |
group | string | Attachments visibility group |
name | string | Preferred name for attach files |
authorLogin | string | Attachment submitter login |
created | instant | Attachment creation time |
files | files | List of files to attach to an issue. |
To define author and creation date 'Low-Level Administration' permission is required.
Files to attach are sent as request body using 'multipart/form-data' content type.
Sample
Request
POST https://example.com/youtrack/rest/issue/CMN-1917/attachment?authorLogin=webster&created=1149678852000
Content-Length: 7839
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------7d159c1302d0y0
Cookie: $Version=0; JSESSIONID=1eufd2pvosy59101uv1zr0bi1y; $Path=/; jetbrains.charisma.main.security.PRINCIPAL=NDgxMzQ5NGQxMzdlMTYzMWJiYTMwMWQ1YWNhYjZlN2JiN2FhNzRjZTExODVkNDU2NTY1ZWY1MWQ3Mzc2NzdiMjpyb290; $Path=/
-----------------------------7d159c1302d0y0
Content-Disposition: form-data; name="flag.png"; filename="flag.png"
Content-Type: image/png
Content-Transfer-Encoding: binary
<actual file content, not shown here>
-----------------------------7d159c1302d0y0--
Response
HTTP/1.1 201 Created
Content-Type: application/xml;charset=UTF-8
Location: https://example.com/youtrack/rest/issue/CMN-1917/attachment/_persistent/flag.png?file=45-50&v=0&c=true
Content-Length: 0
Last modified: 30 March 2021