CreateWorkitemAttachment

Updated at:

Applicable editions

Central edition, Region edition

Service endpoint and authorization

Product

Resource

Required permissions

Project Collaboration

workitem attachments

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/projex/organizations/{organizationId}/workitems/{id}/attachments

Region edition

POST https://{domain}/oapi/v1/projex/workitems/{id}/attachments

Request header

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

The personal access token.

pt-0fh3****0fbG_35af****0484

Request parameters

Parameter

Type

In

Required

Description

Example value

id

string

path

Yes

The unique identifier for the workitem.

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

-

multipart/form-data

body

No

file

File

body

Yes

The file to upload.

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/projex/organizations/{organizationId}/workitems/{id}/attachments' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --form 'file=@"your-file-path.png"'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/projex/workitems/{id}/attachments' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --form 'file=@"your-file-path.png"'

Response parameters

Parameter

Type

Description

Example value

-

object

embedHtml

string

An <img> snippet to copy into the workitem description in RICHTEXT mode.

<img src="https://xxx.test.com/embed/xxx" />

embedMarkdown

string

A Markdown image snippet to copy into the workitem description in MARKDOWN mode.

![image](https://xxx.test.com/embed/xxx)

embedUrl

string

A permanent URL for embedding an image in the workitem description. Unlike the temporary signed URL in the 'url' parameter, this URL does not expire.

https://xxx.test.com/embed/xxx

id

string

The file ID.

985353d622cc8521793e08****

name

string

The file name.

name-xxx

size

integer

The file size in bytes.

1024

suffix

string

The file name suffix.

.png

url

string

A temporary, signed URL for downloading the file. This URL expires.

https://xxx.test.com

Response example

{
    "embedHtml": "<img src="https://xxx.test.com/embed/xxx" />","embedMarkdown": "![image](https://xxx.test.com/embed/xxx)",
    "embedUrl": "https://xxx.test.com/embed/xxx",
    "id": "985353d622cc8521793e08****",
    "name": "name-xxx",
    "size": 1024,
    "suffix": ".png",
    "url": "https://xxx.test.com"
}

Error codes

For a list of API error codes, see the Error Code Center.