Uploads an attachment to a work item.
Function
Uploads an attachment to a work item.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v4/projects/{project_id}/issues/{issue_id}/attachments/upload
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition A 32-character UUID. It uniquely identifies a project. Obtain a project ID by calling the API for querying projects. The value of project_id in the response message body is a project ID. Constraints A string of 32 characters consisting of letters and digits. Range N/A Default Value N/A |
| issue_id | Yes | Integer | Definition Work item ID, which can be obtained from the API for performing advanced query of work items. The value of the id field in the response body is the work item ID. Constraints N/A Range ≥ 0 Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| attachment | Yes | File | Definition: Attachment. Constraints: Maximum upload size: 50 MB. |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| disk_filename | String | Definition: Cloud disk name. Options: N/A |
| file_name | String | Definition: File name. Options: N/A |
| id | Integer | Definition Association ID. Range N/A |
| issue_id | Integer | Definition Work item ID. Range N/A |
| project_id | String | Definition Project ID. Range N/A |
| size | String | Definition: File size. Options: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Value range: N/A |
| error_msg | String | Definition: Error description. Value range: N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Value range: N/A |
| error_msg | String | Definition: Error description. Value range: N/A |
| request_id | String | Definition Request ID, which is automatically generated by the system. Range N/A |
Example Requests
POST https://{endpoint}/v4/projects/0792b7d26cb74bd799cbae80063dc74a/attachments/upload
------WebKitFormBoundary1kuNerRnRVVybt65
Content-Disposition: form-data; name="attachment"; filename="demo.PNG"
Content-Type: image/png Example Responses
Status code: 200
{
"disk_filename" : "adfadsfasdfa.jpg",
"file_name" : "demo.jpg",
"id" : "1234,",
"issue_id" : "1232,",
"project_id" : "2c42a6d37ccc4197bf0b3dbe91be021a",
"size" : "1233"
} Status Codes
| Status Code | Description |
|---|---|
| 200 | Response to the request for uploading a work item attachment. |
| 400 | Bad Request |
| 401 | Unauthorized |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot