Attach a file
Use this request to attach a file to an issue.
Request format
To attach a file, use an HTTP POST
request:
POST /v2/issues/<issue-id>/attachments/?filename=<new file name>
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth token>
X-Org-Id: <organization ID>
<file data>
- <issue-id>
- Issue ID or key.
- filename (optional)
-
The new name of the file to use for storing it on the server. Optional parameter.
- <file data>
-
The file in binary format.
Response format
If the request is successful, the API returns a response with the code 201. The response body contains the parameters of the attached file in JSON format:
{
"self" : "<адрес ресурса API, соответствующего прикрепленному файлу>",
"id" : "<идентификатор файла>",
"name" : "<имя файла>",
"content" : "<адрес для скачивания файла>",
"thumbnail" : "<адрес для скачивания превью>",
"createdBy" : {
"self" : "<ресурс, соответствующий создателю файла>",
"id" : "<логин создателя>",
"display" : "<имя создателя>"
},
"createdAt" : "<дата и время добавления файла>",
"mimetype" : "<тип данных файла>",
"size" : <размер файла>
"metadata" : {
"size" : "<геометрический размер (для изображений)>"
}
}
text/plain
— Text file.image/png
— Image in PNG format.text/plain
— Text file.image/png
— Image in PNG format.
Parameter | Description | Data type |
---|---|---|
self | URL of the API resource that corresponds to the attached file. | String. |
id | Unique identifier of the file. | String. |
name | Name of the file. | String. |
content | URL of the file download resource. | String. |
thumbnail | URL of the resource for downloading preview thumbnails. Available for image files only. | String. |
createdBy | An object with information about the user who attached the file. | JSON object. |
createdAt | Date and time the file was uploaded in the format: | String. |
mimetype | File type: | String. |
size | File size in bytes. | Integer. |
metadata | Object with file metadata. | JSON object. |
Fields for the createdBy object | ||
self | URL of the resource corresponding to the user who uploaded the file. | String. |
id | User login. | String. |
display | The user's name (as shown in the interface). | String. |
Fields for the metadata object | ||
size | The size of the image in pixels. | String. |
Parameter | Description | Data type |
---|---|---|
self | URL of the API resource that corresponds to the attached file. | String. |
id | Unique identifier of the file. | String. |
name | Name of the file. | String. |
content | URL of the file download resource. | String. |
thumbnail | URL of the resource for downloading preview thumbnails. Available for image files only. | String. |
createdBy | An object with information about the user who attached the file. | JSON object. |
createdAt | Date and time the file was uploaded in the format: | String. |
mimetype | File type: | String. |
size | File size in bytes. | Integer. |
metadata | Object with file metadata. | JSON object. |
Fields for the createdBy object | ||
self | URL of the resource corresponding to the user who uploaded the file. | String. |
id | User login. | String. |
display | The user's name (as shown in the interface). | String. |
Fields for the metadata object | ||
size | The size of the image in pixels. | String. |
Possible response codes
- 201
-
The
POST
request created a new object. - 404
- The requested object was not found. You might have entered an incorrect object ID or key value.