SearchWorkitems - 搜索工作项

通过 OpenAPI 搜索工作项。

适用版本

标准版

服务接入点与授权信息

  • 获取服务接入点,替换 API 请求语法中的 <domain> :服务接入点(domain)

  • 获取个人访问令牌,具体操作,请参见获取个人访问令牌

  • 获取organizationId,请前往组织管理后台基本信息页面获取组织 ID 。

    产品

    资源

    所需权限

    项目协作

    工作项

    只读

请求语法

POST https://{domain}/oapi/v1/projex/organizations/{organizationId}/workitems:search

请求头

参数

类型

是否必填

描述

示例值

x-yunxiao-token

string

个人访问令牌。

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

请求参数

参数

类型

位置

是否必填

描述

示例值

organizationId

string

path

企业ID。

5ebbc0228123212b59xxxxx

spaceId

string 

body 

项目 id。

-

object

body

category

string

body

搜索的工作项类型,例如 Req,多值用逗号隔开。

Req

conditions

string

body

过滤条件是一个 JSON 串,格式为{“conditionGroups”:[[filterObject,filterObject,…]]}, 每个字段如何拼接可参考需求列表页面过滤时请求的 AJAX 接口:/workitem/list,以下为一个完整的搜索条件(真实场景中可以按需选取对应的值)“conditionGroups”:[[{“fieldIdentifier”:“status”,“operator”:“CONTAINS”,“value”:[“100005”,“100010”,“154395”],“toValue”:null,“className”:“status”,“format”:“list”}]]}。

{“conditionGroups”:[[{“fieldIdentifier”:“status”,“operator”:“CONTAINS”,“value”:[“100005”,“100010”,“154395”],“toValue”:null,“className”:“status”,“format”:“list”}]]}

orderBy

string

body

排序字段,默认为 gmtCreate

请求示例

curl -X 'POST' \
  'https://test.rdc.aliyuncs.com/oapi/v1/projex/organizations/{organizationId}/workitems:search' \
  -H 'Content-Type: application/json' \
  -H 'x-yunxiao-token: pt-0fh3****0fbG_35af****0484' \
  --data '
    {
        "category": "Req",
        "conditions": "{"conditionGroups":[[{"fieldIdentifier":"status","operator":"CONTAINS","value":["100005","100010","154395"],"toValue":null,"className":"status","format":"list"}]]}",
        "orderBy": "gmtCreate",
        "page": 1,
        "perPage": 20,
        "sort": "desc",
        "spaceId": ""
    }'

返回参数

参数

类型

描述

示例值

-

array(object)

assignedTo

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

categoryId

string

工作项分类 id。

Req

creator

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

customFieldValues

array(object)

自定义字段值。

fieldFormat

string

字段类型。

User

fieldId

string

字段 id。

126553d622cc8521793e08****

fieldName

string

字段名称。

field-name-xxx

values

array(object)

字段值。

displayValue

string

显示的名称。

identifier

string

值的唯一标识。

formatType

string

描述的格式,目前支持 RICHTEXT 和 MARKDOWN。

RICHTEXT

gmtCreate

string

创建时间。

gmtModified

string

修改时间。

id

string

工作项 id。

id-2

idPath

string

工作项 idPath。

id-1,id-2

labels

array

标签。

-

object

color

string

颜色。

test

id

string

id。

id-xxx

name

string

名称。

test

logicalStatus

string

逻辑状态, normal 为正常状态, archived 为归档状态。

normal

modifier

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

parentId

string

父工作项 id。

id-1

participants

array

参与人。

-

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

serialNumber

string

编号。

DSDD-123

space

object

id

string

id。

id-xxx

name

string

名称。

test

sprint

object

id

string

id。

id-xxx

name

string

名称。

test

status

object

displayName

string

显示名称。

待处理

id

string

id。

id-xxx

name

string

名称。

待处理

nameEn

string

英文名称。

TODO

statusStageId

string

状态阶段 id。

id-xxx

subject

string

标题。

test

trackers

array

跟踪人。

-

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

updateStatusAt

string

状态更新时间。

verifier

object

id

string

用户 id。

674d96abd497cd558d68****

name

string

名称。

name-xxx

versions

array

版本。

-

object

id

string

id。

id-xxx

name

string

名称。

test

workitemType

object

id

string

id。

id-xxx

name

string

名称。

test

返回示例

[
    {
        "assignedTo": {
            "id": "user-id-xxx",
            "name": "name-xxx"
        },
        "categoryId": "Req",
        "creator": {
            "id": "674d96abd497cd558d68****",
            "name": "name-xxx"
        },
        "customFieldValues": [
            {
                "fieldFormat": "User",
                "fieldId": "126553d622cc8521793e08****",
                "fieldName": "field-name-xxx",
                "values": [
                    {
                        "displayValue": "",
                        "identifier": ""
                    }
                ]
            }
        ],
        "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": "待处理",
            "id": "id-xxx",
            "name": "待处理",
            "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"
        }
    }
]

响应头

参数

描述

示例值

x-next-page

下一页。

x-page

当前页。

x-per-page

每页数据条数。

x-prev-page

上一页。

x-total

总数据量。

x-total-pages

总分页数。

错误码

访问错误码中心查看 API 相关错误码。