Importing files
Warning
This request can only be executed if the user has permission to edit the issue that files are attached to.
Use it to import to Tracker files that are attached to issues and to their comments.
Request format
To import a file, use an HTTP POST
request. Provide the file in the request body using multipart/form-data
RFC-7578
POST /v2/issues/<issue_ID_or_key>/attachments/_import?filename={filename}&createdAt={createdAt}&createdBy={createdBy}
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
Content-Type: multipart/form-data
<file>
Headers
-
Host
Address of the node that provides the API:https://https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <OAuth_token>
format, e.g.:OAuth 0c4181a7c2cf4521964a72ff********
-
X-Org-ID or X-Cloud-Org-ID
Organization ID. If you only have a Yandex Cloud Organization organization, use the
X-Cloud-Org-ID
header; if only Yandex 360 for Business or both organization types, useX-Org-ID
. -
Content-Type
Request body format. The required value is
multipart/form-data
.
Resource
Parameter | Description | Data type |
---|---|---|
<issue_ID_or_key> | Key of the issue to attach the file to. | String |
<comment_ID> | ID of the comment to attach the file to. | String |
Request parameters
Required parameters
Parameter | Description | Data type |
---|---|---|
filename | File name, no more than 255 characters. | String |
createdAt | Date and time when the file is attached, in YYYY-MM-DDThh:mm:ss.sss±hhmm format. You can specify any value in the interval from the issue's creation time to its latest update. |
String |
createdBy | Username or ID of the user who attached the file. | String |
Request body parameters
Required parameters
Parameter | Description | Data type |
---|---|---|
file_data | Binary file up to 1024 Mb | String |
POST /v2/issues/<issue_ID_or_key>/comments/<comment_ID>/attachments/_import?filename={filename}&createdAt={createdAt}&createdBy={createdBy}
Host: https://api.tracker.yandex.net
Authorization: OAuth <OAuth_token>
X-Org-ID: <organization ID>
Content-Type: multipart/form-data
<file>
Headers
-
Host
Address of the node that provides the API:https://https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <OAuth_token>
format, e.g.:OAuth 0c4181a7c2cf4521964a72ff********
-
X-Org-ID or X-Cloud-Org-ID
Organization ID. If you only have a Yandex Cloud Organization organization, use the
X-Cloud-Org-ID
header; if only Yandex 360 for Business or both organization types, useX-Org-ID
. -
Content-Type
Request body format. The required value is
multipart/form-data
.
Resource
Parameter | Description | Data type |
---|---|---|
<issue_ID_or_key> | Key of the issue to attach the file to. | String |
<comment_ID> | ID of the comment to attach the file to. | String |
Request parameters
Required parameters
Parameter | Description | Data type |
---|---|---|
filename | File name, no more than 255 characters. | String |
createdAt | Date and time when the file is attached, in YYYY-MM-DDThh:mm:ss.sss±hhmm format. You can specify any value in the interval from the issue's creation time to its latest update. |
String |
createdBy | Username or ID of the user who attached the file. | String |
Request body parameters
Required parameters
Parameter | Description | Data type |
---|---|---|
<file> | Binary file up to 1024 Mb | String |
Response format
If the request is successful, the API returns a response with code 200 OK
.
The response body contains the parameters of the attached file in JSON format:
{
"self" : "https://https://api.tracker.yandex.net/v2/issues/JUNE-2/attachments/123",
"id" : "123",
"name" : "pic.png",
"content" : "https://api.tracker.yandex.net/v2/issues/JUNE-2/attachments/123/pic.png",
"thumbnail" : "https://api.tracker.yandex.net/v2/issues/JUNE-2/thumbnails/123",
"createdBy" : {
"self" : "https://https://api.tracker.yandex.net/v2/users/12********",
"id" : "12********",
"display" : "<displayed_employee_name>"
},
"createdAt" : "2017-06-11T05:16:01.339+0000",
"mimetype" : "image/png",
"size" : 5678
"metadata" : {
"size" : "128x128"
}
}
Response parameters
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource corresponding to the attached file | String |
id | File's unique ID. | String |
name | File name. | String |
content | Address of the resource to download the file from. | String |
thumbnail | Address of the resource to download the preview thumbnail from; available for image files only. | String |
createdBy | Object with information about the user who attached the file | JSON object |
createdAt | Date and time when the file is uploaded, in YYYY-MM-DDThh:mm:ss.sss±hhmm format |
String |
mimetype | File type, for example:
|
String |
size | File size in bytes. | Integer |
metadata | Object with file metadata | JSON object |
createdBy
object fields
Parameter | Description | Data type |
---|---|---|
self | Address of the resource corresponding to the user who uploaded the file. | String |
id | User's login. | String |
display | User's name (as in the interface). | String |
metadata
object fields
Parameter | Description | Data type |
---|---|---|
size | Image size in pixels. | String |
If the request is processed incorrectly, the API returns a message with error details:
- 400
- One or more request parameters have an invalid value.
- 403
- Insufficient rights to perform this action. You can check what rights you have in the Tracker interface. The same rights are required to perform an action via the API and interface.
- 404
- The requested object was not found. You may have specified an invalid object ID or key.
- 413
- The file size exceeds 1024 Mb.
- 422
- JSON validation error, the request is rejected.
- 500
- Internal service error. Try resending your request in a few minutes.
- 503
- The API service is temporarily unavailable.