Updated on 2025-10-24 GMT+08:00

Uploading Attachments

Function

This API is used to upload attachments. If attachments need to be uploaded during service ticket (incident ticket, change ticket, or issue ticket) creation, you need to call this API to upload the files to OBS first. When the upload is successful, the unique ID of the document is returned. Only JPG, PNG, DOCX, TXT, and PDF files are supported, and the file size cannot exceed 10 MB.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    coc:ticket:uploadFile

    Write

    -

    -

    -

    -

URI

POST /v1/{ticket_type}/attachments

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

ticket_type

Yes

String

Definition:

In the service ticket creation scenario, the ticket_type field must be set to incident as the service ticket type. Note: Although the preset value of this field points to the incident type, this interface is still used to submit attachments when a change ticket or issue ticket is created and an attachment needs to be uploaded.

Constraints:

N/A

Value range:

Fixed value: incident

Default value:

N/A

Request Parameters

Table 2 FormData parameters

Parameter

Mandatory

Type

Description

file

Yes

File

Definition:

File to be uploaded, which is uploaded in the form format.

Constraints:

The content is binary text. Only JPG, PNG, DOCX, TXT, and PDF files are supported, and the file size cannot exceed 10 MB.

Value range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

code

String

Definition:

Request response code.

Value range:

GOM.00000000~GOM.00009999999

Default value:

GOM.00000000

provider_code

String

Definition:

Service code.

Value range:

N/A

Default value:

049

msg

String

Definition:

Response description for a request.

  • If the code is 0, this parameter is left blank.

  • If the code is not 0, the value of this parameter is the error description.

Value range:

N/A

Default value:

N/A

data

ExternalAttachment object

Information about the attachment that is successfully uploaded.

name

String

Definition:

Attachment file name.

Value range:

N/A

Default value:

N/A

id

String

Definition:

Unique ID of an attachment.

Value range:

N/A

Default value:

N/A

Table 4 ExternalAttachment

Parameter

Type

Description

doc_id

String

Definition:

Unique ID of an attachment.

Value range:

N/A

Default value:

N/A

doc_name

String

Definition:

Attachment file name.

Value range:

N/A

Default value:

N/A

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

provider_code

String

Definition:

Service ID.

Value range:

N/A

Default value:

049

error_code

String

Definition:

Request response code.

Value range:

GOM.00000000~GOM.00009999999

Default value:

GOM.00000000

error_msg

String

Definition:

Response description for a request.

Value range:

N/A

Example Requests

Request example for uploading an attachment.

POST https://{Endpoint}/v1/incident/attachments

form-data form:
key: file
value: binary file

Example Responses

Status code: 200

Request succeeded.

For more status codes, see Status Codes.

{
  "name" : "uploadFile.doc",
  "id" : "78f86d47-55d6-4e98-ba51-b293ac95bc8a",
  "error_code" : "GOM.00000000",
  "error_msg" : null,
  "provider_code" : 4,
  "data" : {
    "doc_id" : "78f86d47-55d6-4e98-ba51-b293ac95bc8a",
    "doc_name" : "uploadFile.doc"
  }
}

Status code: 400

The server failed to process the request.

For more status codes, see Status Codes.

{
  "error_code" : "GOM.00007256",
  "error_msg" : "Invalid parameter",
  "provider_code" : 4,
  "data" : null
}

Status Codes

Status Code

Description

200

Request succeeded.

For more status codes, see Status Codes.

400

The server failed to process the request.

For more status codes, see Status Codes.

Error Codes

See Error Codes.