查询看板项目下的工作项
功能介绍
查询看板项目下的工作项
调用方法
请参见如何调用API。
URI
GET /v4/projects/{project_id}/work-items
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
project_id |
是 |
String |
参数解释: 项目的32位uuid,项目唯一标识,通过[查询项目列表]接口获取,响应消息体中的project_id字段的值就是项目ID。 约束限制: 正则表达式,[A-Za-z0-9]{32}。 取值范围: 不涉及 默认取值: 不涉及。 |
参数 |
是否必选 |
参数类型 |
描述 |
---|---|---|---|
offset |
否 |
Integer |
参数解释: 分页索引,偏移量,offset是limit的整数倍数 约束限制: 正则表达式,0|[1-9]\d{0,10}。 取值范围: 最小值:0 默认取值: 0 |
limit |
否 |
Integer |
参数解释: 每页显示查询看板下工作项的数量 约束限制: 不涉及 取值范围: 最小值:1 最大值:100 默认取值: 100 |
created_time_interval |
否 |
String |
参数解释: 根据工作项的创建时间查询工作项(查询的起始时间,查询的结束时间),unix时间戳,单位:毫秒 样例:1576114296000,1576114396000 约束限制: 正则表达式,([1-9][0-9]{0,12})?(,)?([1-9][0-9]{0,12})?。 取值范围: 不涉及 默认取值: 不涉及 |
请求参数
无
响应参数
状态码:200
参数 |
参数类型 |
描述 |
---|---|---|
total |
Integer |
参数解释: 查询看板下工作项总数 取值范围: 不涉及 |
work_items |
Array of Workitems objects |
参数解释: 工作项信息 |
参数 |
参数类型 |
描述 |
---|---|---|
actual_work_hours |
Double |
参数解释: 实际工时 取值范围: 最小值:0 |
assigned_cc_user |
Array of WorkitemUser objects |
参数解释: 抄送人 |
assigned_user |
WorkitemUser object |
参数解释: 处理人 |
author |
WorkitemUser object |
参数解释: 创建人 |
begin_time |
String |
参数解释: 工作项开始时间,unix时间戳,单位:毫秒,样例:1590940800000 取值范围: 不涉及 |
created_time |
String |
参数解释: 创建时间,unix时间戳,单位:毫秒,样例:1590940800000 取值范围: 不涉及 |
custom_fields |
Array of WorkitemCustomField objects |
参数解释: 用户自定义字段 |
description |
String |
参数解释: 工作项描述 取值范围: 不涉及 |
developer |
WorkitemUser object |
参数解释: 开发人员 |
discover_version |
String |
参数解释: 发现问题的版本 取值范围: 不涉及 |
domain |
domain object |
参数解释: 领域 |
done_ratio |
String |
参数解释: 工作项完成度 ,如20,表示完成度为20% 取值范围: 最小值 0 最大值 100 |
end_time |
String |
参数解释: 工作项结束时间,unix时间戳,单位:毫秒,样例:1590940800000 取值范围: 不涉及 |
expected_work_hours |
Double |
参数解释: 预计工时 取值范围: 最小值:0 |
id |
String |
参数解释: 工作项id 取值范围: 0至9999999999 |
important |
String |
参数解释: 重要程度 "关键", "重要", "一般", "提示" 取值范围: 关键,重要,一般,提示 |
iteration |
iteration object |
参数解释: 迭代 |
module |
module object |
参数解释: 模块 |
order |
String |
参数解释: 顺序 取值范围: 不涉及 |
parent_work_item_id |
String |
父工作项的id 取值范围: 不涉及 |
priority |
String |
参数解释: 工作项优先级 取值范围: 不涉及 |
release_version |
String |
参数解释: 发布的版本 取值范围: 不涉及 |
sequence |
String |
参数解释: 工作项编号 取值范围: 不涉及 |
severity |
String |
参数解释: 严重的程度 "提示", "一般", "严重", "致命" 取值范围: 提示,一般,严重,致命 |
status |
status object |
参数解释: 工作项状态 |
story_point |
String |
参数解释: 故事点 取值范围: 不涉及 |
subject |
String |
参数解释: 工作项标题 取值范围: 不涉及 |
tags |
Array of tags objects |
参数解释: 标签 |
updated_time |
String |
参数解释: 更新时间,unix时间戳,单位:毫秒,样例:1590940800000 取值范围: 不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释: 用户32位uuid 取值范围: 不涉及 |
name |
String |
参数解释: 用户名 取值范围: 不涉及 |
nick_name |
String |
参数解释: 用户昵称 取值范围: 不涉及**** |
参数 |
参数类型 |
描述 |
---|---|---|
field_id |
String |
参数解释: 自定义字段id 取值范围: 不涉及 |
field_name |
String |
参数解释: 自定义字段名称 取值范围: 不涉及 |
field_option_source |
String |
参数解释: 自定义字段的选项源,枚举: CUSTOM USER DOMAIN ITERATION MODULE TAG 取值范围: CUSTOM,USER,DOMAIN,ITERATION,MODULE,TAG |
field_type |
String |
参数解释: 自定义字段类型,枚举: Date Number DateTime MultiLineText SingleLineText Select Checkbox 取值范围: Date,Number,DateTime,MultiLineText,SingleLineText,Select,Checkbox |
value |
String |
参数解释: 自定义字段值 (field_type为Date,Number,DateTime时,field_option_source为空,value值是数字的字符串), (field_type为MultiLineText,SingleLineText时,field_option_source为空,value值是文本字符串), (field_type为Select,field_option_source为CUSTOM时,value值是文本字符串), (field_type为Select ,field_option_source为USER,DOMAIN,ITERATION,MODULE,TAG时,value值是Json格式{}), (field_type为Checkbox ,field_option_source为CUSTOM时,value值是字符串数组["aaa"]), (field_type为"Checkbox",field_option_source为USER,DOMAIN,ITERATION,MODULE,TAG时,value值是Json的数组[{},{}])。 取值范围: 不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释: 领域id: 枚举: 14(性能) 15(功能) 16('可靠性) 17(网络安全) 18(可维护性) 19(其他DFX) 20(可用性) 取值范围: 14,15,16,17,18,19,20 |
name |
String |
参数解释: 领域名称 取值范围: 不涉及 |
参数 |
参数类型 |
描述 |
---|---|---|
id |
String |
参数解释: 状态id,枚举: 1(新建) 2(进行中) 3(已解决) 4(测试中) 5( 已关闭) 6(已拒绝) 取值范围: 1,2,3,4,5,6 |
name |
String |
参数解释: 状态名称 取值范围: 不涉及 |
状态码:400
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
状态码:401
参数 |
参数类型 |
描述 |
---|---|---|
error_code |
String |
错误码 |
error_msg |
String |
错误描述 |
请求示例
GET https://{endpoint}/v4/projects/526cefde62004de2b62b5e8dd2c2b3af/work-items
响应示例
状态码:200
OK
{
"work_items" : [ {
"id" : "4633454879781163008",
"description" : "demo",
"actual_work_hours" : 10,
"assigned_user" : {
"id" : "665b542eb4c14b53a15ead449f28b0ba",
"name" : "demo_user_name",
"nick_name" : "demo"
},
"author" : {
"id" : "665b542eb4c14b53a15ead449f28b0ba",
"name" : "demo_user_name",
"nick_name" : "demo"
},
"begin_time" : "1590940800000",
"created_time" : "1590940800000",
"tags" : [ {
"id" : "456",
"name" : "tagdemo"
} ],
"developer" : {
"id" : "665b542eb4c14b53a15ead449f28b0ba",
"name" : "demo_user_name",
"nick_name" : "demo"
},
"assigned_cc_user" : [ {
"id" : "665b542eb4c14b53a15ead449f28b0ba",
"name" : "demo_user_name",
"nick_name" : "demo"
} ],
"discover_version" : "ProjectMan 8.0.0",
"end_time" : "1590940800000",
"done_ratio" : "10%",
"expected_work_hours" : 9,
"order" : "1",
"parent_work_item_id" : "4633454879781163001",
"release_version" : "ProjectMan 8.0.0",
"story_point" : "0",
"domain" : {
"id" : "14",
"name" : "性能"
},
"iteration" : {
"id" : "456",
"name" : "迭代1"
},
"module" : {
"id" : "456",
"name" : "Project"
},
"priority" : "低",
"severity" : "一般",
"status" : {
"id" : "d25fe91f7f6b489db5f804e66ac3b360",
"name" : "新建"
},
"subject" : "demosubject",
"updated_time" : "1595832054113",
"sequence" : "5500756",
"important" : "提示",
"custom_fields" : [ {
"field_id" : "d25fe91f7f6b489db5f804e66a0",
"field_name" : "customField",
"field_type" : "Select",
"field_option_source" : "USER",
"value" : "{\"id\":\"d25fe91f7f6b489db5f804e66a0\",\"name\":\"devcloud_test001\",\"nick_name\":\"demo\"}"
} ]
} ],
"total" : 1
}
SDK代码示例
SDK代码示例如下。
Java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
package com.huaweicloud.sdk.test;
import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.projectman.v4.region.ProjectManRegion;
import com.huaweicloud.sdk.projectman.v4.*;
import com.huaweicloud.sdk.projectman.v4.model.*;
public class ListWorkitemsSolution {
public static void main(String[] args) {
// The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
// In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
String ak = System.getenv("CLOUD_SDK_AK");
String sk = System.getenv("CLOUD_SDK_SK");
ICredential auth = new BasicCredentials()
.withAk(ak)
.withSk(sk);
ProjectManClient client = ProjectManClient.newBuilder()
.withCredential(auth)
.withRegion(ProjectManRegion.valueOf("<YOUR REGION>"))
.build();
ListWorkitemsRequest request = new ListWorkitemsRequest();
request.withProjectId("{project_id}");
try {
ListWorkitemsResponse response = client.listWorkitems(request);
System.out.println(response.toString());
} catch (ConnectionException e) {
e.printStackTrace();
} catch (RequestTimeoutException e) {
e.printStackTrace();
} catch (ServiceResponseException e) {
e.printStackTrace();
System.out.println(e.getHttpStatusCode());
System.out.println(e.getRequestId());
System.out.println(e.getErrorCode());
System.out.println(e.getErrorMsg());
}
}
}
|
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# coding: utf-8
import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkprojectman.v4 import *
if __name__ == "__main__":
# The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
# In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
ak = os.environ["CLOUD_SDK_AK"]
sk = os.environ["CLOUD_SDK_SK"]
credentials = BasicCredentials(ak, sk)
client = ProjectManClient.new_builder() \
.with_credentials(credentials) \
.with_region(ProjectManRegion.value_of("<YOUR REGION>")) \
.build()
try:
request = ListWorkitemsRequest()
request.project_id = "{project_id}"
response = client.list_workitems(request)
print(response)
except exceptions.ClientRequestException as e:
print(e.status_code)
print(e.request_id)
print(e.error_code)
print(e.error_msg)
|
Go
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
package main
import (
"fmt"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4"
"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model"
region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/region"
)
func main() {
// The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
// In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
ak := os.Getenv("CLOUD_SDK_AK")
sk := os.Getenv("CLOUD_SDK_SK")
auth := basic.NewCredentialsBuilder().
WithAk(ak).
WithSk(sk).
Build()
client := projectman.NewProjectManClient(
projectman.ProjectManClientBuilder().
WithRegion(region.ValueOf("<YOUR REGION>")).
WithCredential(auth).
Build())
request := &model.ListWorkitemsRequest{}
request.ProjectId = "{project_id}"
response, err := client.ListWorkitems(request)
if err == nil {
fmt.Printf("%+v\n", response)
} else {
fmt.Println(err)
}
}
|
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
状态码 |
描述 |
---|---|
200 |
OK |
400 |
Bad Request |
401 |
Unauthorized |
错误码
请参见错误码。