CreateTestcaseComment - Create a comment for a test case

Updated at:

Creates a comment for a specified test case.

Applicable editions

Central edition, Region edition

Endpoint and authorization information

  • Get the endpoint: Replace the {domain} placeholder in the API request syntax.

  • Obtain an access token.

  • Obtain the organizationId: Required only for the Central edition. Go to the Basic Information page in the Organization Management console to get the organization ID.

Product

Resource

Required permission

Test Management

Test case

Read/Write

Request syntax

Central edition

POST https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testRepos/{testRepoId}/testcases/{id}/comments

Region edition

POST https://{domain}/oapi/v1/testhub/testRepos/{testRepoId}/testcases/{id}/comments

Request headers

Parameter

Type

Required

Description

Example value

x-yunxiao-token

string

Yes

Your personal access token.

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

Request parameters

Parameter

Type

Location

Required

Description

Example value

id

string

path

Yes

The unique identifier of the test case.

organizationId

string

path

  • Yes: Central edition

  • No: Region edition

The organization ID.

testRepoId

string

path

Yes

The unique identifier of the test case library.

-

object

body

No

content

string

body

Yes

The comment content.

This is a comment.

formatType

string

body

No

The content format. Valid values: RICHTEXT and MARKDOWN. Default value: RICHTEXT.

RICHTEXT

parentId

string

body

No

The ID of the parent comment. Set this parameter to reply to an existing comment.

1112333

Request example

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testRepos/{testRepoId}/testcases/{id}/comments' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "content": "This is a comment.",
        "formatType": "RICHTEXT",
        "parentId": "1112333"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/testRepos/{testRepoId}/testcases/{id}/comments' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "content": "This is a comment.",
        "formatType": "RICHTEXT",
        "parentId": "1112333"
    }'

Response parameters

Parameter

Type

Description

Example value

-

object

id

string

The comment ID.

id-xxx

Response example

{
    "id": "id-xxx"
}

Error codes

For the error codes of this operation, see Error code center.