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

Uploading Attachments

Function

This API is used to upload an attachment. If an attachment needs to be uploaded when an incident ticket is created, this API is called to upload the file to OBS. 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/external/incident/attachments

Request Parameters

Table 1 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 2 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.

Table 3 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 4 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.

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

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

Example Responses

Status code: 200

Request succeeded.

For more status codes, see Status Codes.

{
  "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.