SearchWorkitems - 搜索工作项
Use OpenAPI to search for work items. In the parameters, spaceId is a project ID or project collection ID. This operation does not support searching across multiple projects. To search by project view, provide viewIdentifier from the page URL to reuse its saved filter conditions. The pagination window is limited to page * perPage <= 10000 for both project and project collection searches. This limit defines the accessible pagination range and does not mean that 10,000 results always exist. If perPage is 200, you can query up to page 50; page 51 returns HTTP 400. Stop paging based on the returned total count or total pages. To query more data, narrow the conditions, for example by splitting the update time range, and restart each range from page 1.
|
Applicable editions |
Central edition, Region edition |
Endpoints and authorization information
- Get the endpoint: Replace {domain} in the API request syntax.
- Obtain a personal access token。
- Obtain an organization ID:Required only for the Central edition. Go to theorganization management consoleand obtain the organization ID from thebasic informationpage.
|
Product |
Resource |
Required permission |
|
Project Collaboration |
Work items |
Read-only |
Request syntax
Central edition
POST https://{domain}/oapi/v1/projex/organizations/{organizationId}/workitems:search
Region edition
POST https://{domain}/oapi/v1/projex/workitems:search
Request headers
|
Parameter |
Type |
Required |
Description |
Example value |
|
x-yunxiao-token |
string |
Yes |
Personal access token. |
pt-0fh3****0fbG_35af****0484 |
Request parameters
|
Parameter |
Type |
Location |
Required |
Description |
Example value |
|
organizationId |
string |
path |
|
Organization ID. |
|
| - |
object |
body |
No |
||
| category |
string |
body |
Yes |
Type of work item to search for, such as Req. Separate multiple values with commas. |
Req |
| conditions |
string |
body |
No |
Filter conditions as a JSON string in the format {"conditionGroups":[[filterObject,filterObject,...]]}. To learn how to construct each field, refer to the AJAX request used on the requirements list page when filtering: workitem/list. You can set filters on the page first, then copy the conditions parameter from the workitem/list API call.<br/>Common filterObject examples:<br/>Title contains test:<br/>{"fieldIdentifier": "subject","operator": "CONTAINS","value": ["test"],"toValue": null,"className": "string","format": "input"},<br/>Status includes specific statuses:<br/>{"fieldIdentifier": "status","operator": "CONTAINS","value": ["28","30","32","100010"],"toValue": null,"className": "status","format": "list"},<br/>Assigned to user with ID 5f2bfdacb69dd0f7311e2932:<br/>{"fieldIdentifier": "assignedTo","operator": "CONTAINS","value": ["5f2bfdacb69dd0f7311e2932"],"toValue": null,"className": "user","format": "list"}<br/>Created by user with ID 5f2bfdacb69dd0f7311e2932:<br/>{"fieldIdentifier": "creator","operator": "CONTAINS","value": ["5f2bfdacb69dd0f7311e2932"],"toValue": null,"className": "user","format": "list"}<br/>Has tag with ID 1589a2b0ae967141c6929f1a78:<br/>{"fieldIdentifier": "tag","operator": "CONTAINS","value": ["1589a2b0ae967141c6929f1a78"],"toValue": null,"className": "tag","format": "multiList"}<br/>Updated between two dates:<br/>{"fieldIdentifier": "gmtCreate","operator": "BETWEEN","value": ["2022-04-01 00:00:00"],"toValue": "2023-03-31 23:59:59","className": "dateTime","format": "input"}. |
{"conditionGroups":[[{"fieldIdentifier":"status","operator":"CONTAINS","value":["100005","100010","154395"],"toValue":null,"className":"status","format":"list"}]]} |
| orderBy |
string |
body |
No |
Field to sort by. Default is gmtCreate.<br/>gmtCreate: Creation time<br/>name: Name. |
gmtCreate |
| page |
integer |
body |
No |
The page number. Default value: 1. page * perPage cannot exceed 10000. Otherwise, HTTP 400 is returned. Narrow the filter range and restart the query from page 1. |
1 |
| perPage |
integer |
body |
No |
The number of entries per page. Valid values: 0 to 200. Default value: 20. page * perPage cannot exceed 10000. If perPage is 200, you can query up to page 50. |
20 |
| sort |
string |
body |
No |
Sort order. Default is desc.<br/>desc: Descending<br/>asc: Ascending. |
desc |
| spaceId |
string |
body |
Yes |
Project ID or program ID. |
|
| spaceType |
string |
body |
No |
Space type: Project or Program. Default: Project. |
Project |
| viewIdentifier | string | body | No | The project view ID from viewIdentifier in the page URL. Supports system views, public views, and personal views owned by the caller in the project. When using this parameter, specify a project ID for spaceId, set spaceType to Project (the default), and specify exactly one work item type in category. Mutually exclusive with conditions. Specify sorting using orderBy and sort. | d7f112f9d023e2108fa1b0d8 |
Request examples
Central edition
curl -X 'POST' \
'https://{domain}/oapi/v1/projex/organizations/{organizationId}/workitems:search' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"category": "Req",
"orderBy": "gmtCreate",
"page": 1,
"perPage": 20,
"sort": "desc",
"spaceId": "{projectId}",
"spaceType": "Project",
"viewIdentifier": "d7f112f9d023e2108fa1b0d8"
}'
Region edition
curl -X 'POST' \
'https://{domain}/oapi/v1/projex/workitems:search' \
-H 'Content-Type: application/json' \
-H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
--data '
{
"category": "Req",
"orderBy": "gmtCreate",
"page": 1,
"perPage": 20,
"sort": "desc",
"spaceId": "{projectId}",
"spaceType": "Project",
"viewIdentifier": "d7f112f9d023e2108fa1b0d8"
}'
Response parameters
|
Parameter |
Type |
Description |
Example value |
| - |
array |
||
| - |
object |
||
| assignedTo |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| categoryId |
string |
Work item category ID. |
Req |
| creator |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| customFieldValues |
array |
Custom field values. |
|
| - |
object |
||
| fieldFormat |
string |
Field type. |
User |
| fieldId |
string |
Field ID. |
126553d622cc8521793e08**** |
| fieldName |
string |
Field name. |
field-name-xxx |
| values |
array |
Field values. |
|
| - |
object |
||
| displayValue |
string |
Display name. |
|
| identifier |
string |
Unique identifier of the value. |
|
| description |
string |
Description. |
test |
| formatType |
string |
Description format. Supported values: RICHTEXT and MARKDOWN. |
RICHTEXT |
| gmtCreate |
string |
Creation time. |
|
| gmtModified |
string |
Modification time. |
|
| id |
string |
Work item ID. |
id-2 |
| idPath |
string |
Work item ID path. |
id-1,id-2 |
| labels |
array |
Labels. |
|
| - |
object |
||
| color |
string |
Color. |
test |
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
test |
| logicalStatus |
string |
Logical status. normal means active. archived means archived. |
normal |
| modifier |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| parentId |
string |
Parent work item ID. |
id-1 |
| participants |
array |
||
| - |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| serialNumber |
string |
Serial number. |
DSDD-123 |
| space |
object |
||
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
test |
| sprint |
object |
||
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
test |
| status |
object |
||
| displayName |
string |
Display name. |
To Do |
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
To Do |
| nameEn |
string |
English name. |
TODO |
| statusStageId |
string |
Status stage ID. |
id-xxx |
| subject |
string |
Title. |
test |
| trackers |
array |
Follow the person. |
|
| - |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| updateStatusAt |
string |
Status update time. |
|
| verifier |
object |
||
| id |
string |
User ID. |
674d96abd497cd558d68**** |
| name |
string |
Name. |
name-xxx |
| versions |
array |
Versions. |
|
| - |
object |
||
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
test |
| workitemType |
object |
||
| id |
string |
ID. |
id-xxx |
| name |
string |
Name. |
test |
Response example
[
{
"assignedTo": {
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
},
"categoryId": "Req",
"creator": {
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
},
"customFieldValues": [
{
"fieldFormat": "User",
"fieldId": "126553d622cc8521793e08****",
"fieldName": "field-name-xxx",
"values": [
{
"displayValue": "",
"identifier": ""
}
]
}
],
"description": "test",
"formatType": "RICHTEXT",
"gmtCreate": "",
"gmtModified": "",
"id": "id-2",
"idPath": "id-1,id-2",
"labels": [
{
"color": "test",
"id": "id-xxx",
"name": "test"
}
],
"logicalStatus": "normal",
"modifier": {
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
},
"parentId": "id-1",
"participants": [
{
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
}
],
"serialNumber": "DSDD-123",
"space": {
"id": "id-xxx",
"name": "test"
},
"sprint": {
"id": "id-xxx",
"name": "test"
},
"status": {
"displayName": "To Do",
"id": "id-xxx",
"name": "To Do",
"nameEn": "TODO"
},
"statusStageId": "id-xxx",
"subject": "test",
"trackers": [
{
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
}
],
"updateStatusAt": "",
"verifier": {
"id": "674d96abd497cd558d68****",
"name": "name-xxx"
},
"versions": [
{
"id": "id-xxx",
"name": "test"
}
],
"workitemType": {
"id": "id-xxx",
"name": "test"
}
}
]
Response headers
|
Parameter |
Description |
Example value |
|
x-next-page |
Next page. |
|
|
x-page |
Current page. |
|
|
x-per-page |
Number of items per page. |
|
|
x-prev-page |
Previous page. |
|
|
x-total |
Total number of items. |
|
|
x-total-pages |
Total number of pages. |
Error codes
Visit the Error Code Center to view API error codes.