CreateWorkitemExtRelationRecord - Link work item to external resource
Links a work item to an external resource. The required fields vary by category.
codeupMergeRequest (Link merge request):
{"category":"codeupMergeRequest","projectId":"4968652","mergeRequestId":"9857ed39f0f64411acd9c29f06d5f91a","title":"fix: xxx","url":"https://codeup.aliyun.com/.../merge_request/1","sourceBranch":"feature/xxx","targetBranch":"master"}
codeupBranch (Link branch):
{"category":"codeupBranch","projectId":"4968652","branchName":"feature/my-branch","title":"feature/my-branch","url":"https://codeup.aliyun.com/.../tree/feature/my-branch"}
codeupCommit (Link commit):
{"category":"codeupCommit","projectId":"4968652","commitSha":"abc123def456","title":"fix: some message","url":"https://codeup.aliyun.com/.../commit/abc123def456"}
ChangeRequest (Link AppStack change request):
{"category":"ChangeRequest","changeRequestId":"cr-xxx-001","title":"Release change request","url":"https://xxx/change-requests/cr-xxx-001"}
|
Applicable editions |
Region edition |
Endpoints and authorization
-
Get endpoints: Replace {domain} in the API request syntax.
-
Get organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to obtain the organization ID.
|
Product |
Resource |
Required permission |
|
Projex |
Work item |
Read/Write |
Request syntax
Region edition
POST https://{domain}/oapi/v1/projex/workitems/{id}/extRelationRecords
Request headers
|
Parameter |
Type |
Required |
Description |
Example |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example |
|
id |
string |
path |
Yes |
Unique identifier of the work item. |
|
| - |
object |
body |
No |
||
|
branchName |
string |
body |
No |
Branch name (required when category=codeupBranch). |
feature/my-branch |
|
category |
string |
body |
Yes |
External resource category. Valid values: codeupMergeRequest / codeupBranch / codeupCommit / ChangeRequest. |
codeupMergeRequest |
|
changeRequestId |
string |
body |
No |
AppStack change request ID (required when category=ChangeRequest). |
cr-xxx |
|
commitSha |
string |
body |
No |
Commit SHA (required when category=codeupCommit). |
abc123def456 |
|
mergeRequestId |
string |
body |
No |
Merge request ID (required when category=codeupMergeRequest). |
1 |
|
projectId |
string |
body |
No |
Repository ID (required for Codeup categories, not needed for AppStack). |
12345 |
|
sourceBranch |
string |
body |
No |
Source branch (optional, only for codeupMergeRequest). |
feature/xxx |
|
targetBranch |
string |
body |
No |
Target branch (optional, only for codeupMergeRequest). |
master |
|
title |
string |
body |
No |
Title or short description of the external resource (optional). |
fix: some bug |
|
url |
string |
body |
No |
External resource URL (optional, applicable to all categories). |
https://codeup.aliyun.com/xxx/merge_request/1 |
Request example
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/projex/workitems/{id}/extRelationRecords' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"branchName": "feature/my-branch",
"category": "codeupMergeRequest",
"changeRequestId": "cr-xxx",
"commitSha": "abc123def456",
"mergeRequestId": "1",
"projectId": "12345",
"sourceBranch": "feature/xxx",
"targetBranch": "master",
"title": "fix: some bug",
"url": "https://codeup.aliyun.com/xxx/merge_request/1"
}'
Response parameters
|
Parameter |
Type |
Description |
Example |
| - |
object |
||
|
id |
string |
ID of the created association record. |
id-xxx |
Response example
{
"id": "id-xxx"
}
Error codes
Visit the error code center to view API error codes.