SearchTestCases - Search for test cases

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 case

Read-only

Request syntax

Central edition

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

Region edition

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

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

id

string

path

Yes

The ID of the test case repository.

organizationId

string

path

  • Yes (Central edition)

  • No (Region edition)

The organization ID.

-

object

body

No

conditions

string

body

No

The filter conditions. The value is a JSON string in the following format: {"conditionGroups":[[filterObject,filterObject,...]]}. To learn how to assemble each field, inspect the /testCase/listByDirectory request that the test case list page sends when a filter is applied. The following is a complete search condition. In practice, keep only the values that you need: {"conditionGroups":[[{"fieldIdentifier":"subject","operator":"CONTAINS","value":["ceshi"],"toValue":null,"className":"string","format":"input"}]]}.

{"conditionGroups":[[{"fieldIdentifier":"subject","operator":"CONTAINS","value":["ceshi"],"toValue":null,"className":"string","format":"input"}]]}

directoryId

string

body

No

The ID of the folder.

dir-id-xxx

orderBy

string

body

No

The field to sort by. Default value: gmtCreate. gmtCreate: the creation time. name: the name.

gmtCreate

page

integer

body

No

The page number.

1

perPage

integer

body

No

The number of entries per page. Valid values: 0 to 200. Default value: 20.

20

sort

string

body

No

The sort order. Default value: desc. desc: descending order. asc: ascending order.

desc

Request examples

Central edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/organizations/{organizationId}/testRepos/{id}/testcases:search' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "conditions": "{"conditionGroups":[[{"fieldIdentifier":"subject","operator":"CONTAINS","value":["ceshi"],"toValue":null,"className":"string","format":"input"}]]}",
        "directoryId": "dir-id-xxx",
        "orderBy": "gmtCreate",
        "page": 1,
        "perPage": 20,
        "sort": "desc"
    }'

Region edition

curl -X 'POST' \
  'https://{domain}/oapi/v1/testhub/testRepos/{id}/testcases:search' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "conditions": "{"conditionGroups":[[{"fieldIdentifier":"subject","operator":"CONTAINS","value":["ceshi"],"toValue":null,"className":"string","format":"input"}]]}",
        "directoryId": "dir-id-xxx",
        "orderBy": "gmtCreate",
        "page": 1,
        "perPage": 20,
        "sort": "desc"
    }'

Response parameters

Parameter

Type

Description

Example value

-

array

-

object

assignedTo

object

id

string

The user ID.

user-id-xxx

name

string

The name of the user.

name-xxx

creator

object

id

string

The user ID.

user-id-xxx

name

string

The name of the user.

name-xxx

customCode

string

The serial number.

DDDD-112

customFieldValues

array

The custom field values.

-

object

fieldFormat

string

The field type.

User

fieldId

string

The field ID.

field-id-xxx

fieldName

string

The field name.

field-name-xxx

values

array

The field values.

-

object

displayValue

string

The display name.

identifier

string

The ID of the value.

directory

object

id

string

The ID of the folder.

id-xxx

name

string

The name of the folder.

test

gmtCreate

string

The time when the test case was created.

2026-08-07T15:28:50Z

gmtModified

string

The time when the test case was last modified.

2026-08-07T15:28:50Z

id

string

The ID of the test case.

id-xxx

labels

array

The labels.

-

object

color

string

The color.

test

id

string

The ID of the label.

id-xxx

name

string

The name of the label.

test

modifier

object

id

string

The user ID.

user-id-xxx

name

string

The name of the user.

name-xxx

preCondition

string

The preconditions. HTML content is returned.

<article class="4ever-article"><p>A registered account</p></article>

preConditionFormat

string

The format of the preconditions. Valid values: RICHTEXT and TEXT.

RICHTEXT

subject

string

The title.

test

testRepo

object

id

string

The ID of the test case repository.

id-xxx

name

string

The name of the test case repository.

test

testSteps

object

content

array

The test step entries when contentType is set to TABLE. Write the expected result in the expected field of each entry. If contentType is set to TEXT and neither stepContent nor expectedResult is specified, the first entry is used as the test step and the expected result.

-

object

expected

string

The expected result.

Expected result 1

step

string

The test step.

Test step 1

contentType

string

The content format. Valid values: TABLE and TEXT.

TEXT

expectedResult

string

The expected result when contentType is set to TEXT. In a request, pass plain text; the server converts it to rich text for storage. In a response, HTML content is returned.

Expected result 1

stepContent

string

The test steps when contentType is set to TEXT. In a request, pass plain text; the server converts it to rich text for storage. In a response, HTML content is returned. If this parameter and content are both specified, this parameter takes precedence.

Test step 1

Response example

[
    {
        "assignedTo": {
            "id": "user-id-xxx",
            "name": "name-xxx"
        },
        "creator": {
            "id": "user-id-xxx",
            "name": "name-xxx"
        },
        "customCode": "DDDD-112",
        "customFieldValues": [
            {
                "fieldFormat": "User",
                "fieldId": "field-id-xxx",
                "fieldName": "field-name-xxx",
                "values": [
                    {
                        "displayValue": "",
                        "identifier": ""
                    }
                ]
            }
        ],
        "directory": {
            "id": "id-xxx",
            "name": "test"
        },
        "gmtCreate": "2026-08-07T15:28:50Z",
        "gmtModified": "2026-08-07T15:28:50Z",
        "id": "id-xxx",
        "labels": [
            {
                "color": "test",
                "id": "id-xxx",
                "name": "test"
            }
        ],
        "modifier": {
            "id": "user-id-xxx",
            "name": "name-xxx"
        },
        "preCondition": "<article class="4ever-article"><p>A registered account</p></article>",
        "preConditionFormat": "RICHTEXT",
        "subject": "test",
        "testRepo": {
            "id": "id-xxx",
            "name": "test"
        },
        "testSteps": {
            "content": [
                {
                    "expected": "Expected result 1",
                    "step": "Test step 1"
                }
            ],
            "contentType": "TEXT",
            "expectedResult": "Expected result 1",
            "stepContent": "Test step 1"
        }
    }
]

Response headers

Parameter

Description

Example value

x-next-page

The next page number.

x-page

The current page number.

x-per-page

The number of entries per page.

x-prev-page

The previous page number.

x-total

The total number of entries.

x-total-pages

The total number of pages.

Error codes

For error codes, see the Error Code Center.