Import 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 files that are attached to issues and their comments to Tracker.
Request format
To import a file, use an HTTP POST
request. Files are passed in the request body via multipart/form-data
RFC-7578. The file size may not exceed 1024 Mb.
POST /v2/issues/<issue_id>/attachments/_import?filename={filename}&createdAt={createdAt}&createdBy={createdBy}
Host: https://api.tracker.yandex.net
Authorization: OAuth <token>
X-Org-ID: <organization ID>
Content-Type: multipart/form-data
<file_data>
-
Host
Address of the node that provides the API:https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <token value>
format. For example:OAuth 0c4181a7c2cf4521964a72ff57a34a07
-
X-Org-ID
Organization ID.
-
Content-Type
Request body format. Must be
multipart/form-data
.
Parameter | Description | Data type |
---|---|---|
<issues-id> | Key of the issue to attach the file to. | String |
<comment_id> | ID of the comment to attach the file to. | String |
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 |
Required parameters
Parameter | Description | Data type |
---|---|---|
file_data | Binary file. The file size may not exceed 1024 Mb. | String |
POST /v2/issues/<issue_id>/comments/<comment_id>/attachments/_import?filename={filename}&createdAt={createdAt}&createdBy={createdBy}
Host: https://api.tracker.yandex.net
Authorization: OAuth <token>
X-Org-ID: <organization ID>
Content-Type: multipart/form-data
<file_data>
-
Host
Address of the node that provides the API:https://api.tracker.yandex.net
-
Authorization
OAuth token in
OAuth <token value>
format. For example:OAuth 0c4181a7c2cf4521964a72ff57a34a07
-
X-Org-ID
Organization ID.
-
Content-Type
Request body format. Must be
multipart/form-data
.
Parameter | Description | Data type |
---|---|---|
<issues-id> | Key of the issue to attach the file to. | String |
<comment_id> | ID of the comment to attach the file to. | String |
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 |
Required parameters
Parameter | Description | Data type |
---|---|---|
<file_data> | Binary file. The file size may not exceed 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://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://api.tracker.yandex.net/v2/users/12314567890",
"id" : "1234567890",
"display" : "<employee name displayed>"
},
"createdAt" : "2017-06-11T05:16:01.339+0000",
"mimetype" : "image/png",
"size" : 5678
"metadata" : {
"size" : "128x128"
}
}
Parameter | Description | Data type |
---|---|---|
self | Address of the API resource corresponding to the attached file. | String |
id | Unique ID of the file. | 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 |
Object fields createdBy
Parameter | Description | Data type |
---|---|---|
self | Address of the resource corresponding to the user who uploaded the file. | String |
id | Username of the user. | String |
display | User's name (as in the interface). | String |
Object fields metadata
Parameter | Description | Data type |
---|---|---|
size | Image size in pixels. | String |
If a request fails, the response message contains details of the errors encountered:
- 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.