Help Center/ CodeArts Req/ API Reference/ APIs/ Work Items of the Scrum Project/ Uploading an Attachment to a Work Item
Updated on 2023-06-12 GMT+08:00

Uploading an Attachment to a Work Item

Function

Uploads an attachment to a work item.

URI

POST /v4/projects/{project_id}/issues/{issue_id}/attachments/upload

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID

issue_id

Yes

String

Work item ID

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token. Call IAM to obtain the user token (value of X-Subject-Token in the response header).

Table 3 FormData parameters

Parameter

Mandatory

Type

Description

attachment

Yes

File

Attachment file. The maximum size is 50 MB.

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

id

Integer

ID of the associated work item

issue_id

Integer

Work item ID

project_id

String

Project ID

disk_filename

String

Storage name on cloud disks

file_name

String

File name

size

String

File size

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

Description

error_code

String

Error Codes

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_msg

String

Description

error_code

String

Error Codes

Example Requests

Post https://{endpoint}/v4/projects/0792b7d26cb74bd799cbae80063dc74a/attachments/upload

Example Responses

Status code: 200

{
  "id" : "1234,",
  "issue_id" : "1232,",
  "project_id" : "2c42a6d37ccc4197bf0b3dbe91be021a",
  "disk_filename" : "adfadsfasdfa.jpg",
  "file_name" : "demo.jpg",
  "size" : "1233"
}

Status Codes

Status Code

Description

200

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.