CreateTestResultBugRelation - Associate a bug with a test result

Updated at:

Applicable editions

Central edition, Region edition

Endpoints and authorization

  • Obtain an endpoint. Replace {domain} in the request syntax with the endpoint.
  • Obtain a personal access token.
  • Obtain an organization ID: Required only for the Central edition. Go to the organization management console and obtain the organization ID from the basic information page.

Product

Resource

Required permissions

Test management

Test plan

Read and write

Request syntax

Central edition

POST https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testPlans/{testplanId}/testcases/{id}/bugs

Region edition

POST https://{domain}/oapi/v1/testhub/testPlans/{testplanId}/testcases/{id}/bugs

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

Location

Required

Description

Example value

organizationId

string

path

  • Yes (Central edition)

  • No (Region edition)

The organization ID.

testplanId

string

path

Yes

The ID of the test plan.

id

string

path

Yes

The ID of the test case.

-

object

body

No

operatorId

string

body

No

The user ID of the operator. This parameter is ignored when a personal access token is used.

user-id-xxx

workitemId

string

body

Yes

The ID of the bug work item.

workitem-id-xxx

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testPlans/{testplanId}/testcases/{id}/bugs' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "operatorId": "user-id-xxx",
        "workitemId": "workitem-id-xxx"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/testPlans/{testplanId}/testcases/{id}/bugs' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "operatorId": "user-id-xxx",
        "workitemId": "workitem-id-xxx"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

id

string

The ID of the association record.

id-xxx

Response example

{
    "id": "id-xxx"
}

Error codes

For error codes, see the Error Code Center.