批量更新工作项 - BatchUpdateIpdIssues
功能介绍
批量更新工作项,单次最多支持50个工作项。
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
URI
PUT /v1/ipdprojectservice/projects/{project_id}/issues/batch
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 参数解释: 项目32位ID,项目唯一标识。通过查询IPD项目列表获取,响应消息体中的id字段的值就是项目ID。 约束限制: 不涉及。 取值范围: 32个字符,由英文字母和数字组成。 默认取值: 不涉及。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 参数解释: 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 约束限制: 不涉及。 取值范围: 10~32768个字符。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| id | 是 | Array of strings | 参数解释: 需要更新的工作项ID数组,可通过高级查询工作项接口获取,响应消息体中的id字段的值就是工作项ID。 约束限制: 18~19位的数字字符串(工作项的id字段对应的字符串)。 |
| attribute | 是 | IssueUpdateAttribute object | 参数解释: 更新的工作项内容。 约束限制: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| description | 否 | String | 参数解释: 工作项描述字段,可通过查询树状工作项接口获取,响应消息体中的description字段的值就是工作项描述字段。 约束限制: 不涉及。 取值范围: 1~500000个字符。 默认取值: 不涉及。 |
| parent_id | 否 | String | 参数解释: 父工作项ID,可通过查询树状工作项接口获取,响应消息体中的parent_id字段的值就是父工作项ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| status | 否 | String | 参数解释: 工作项状态code。可通过查询工作项状态接口获取,响应消息体中的code字段的值就是工作项状态code。 约束限制: 不涉及。 取值范围: 2~32个字符。 默认取值: 不涉及。 |
| assignee | 否 | UserUpdateAttribute object | 参数解释: 工作项责任人。 约束限制: 不涉及。 |
| assigned_cc | 否 | Array of UserUpdateAttribute objects | 参数解释: 工作项抄送人,支持多个抄送人。数组元素为UserUpdateAttribute对象。 约束限制: 同一工作项最多支持50个抄送人。 |
| plan_end_date | 否 | String | 参数解释: 工作项计划结束日期,unix时间戳,单位:毫秒。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| plan_dev_end_date | 否 | String | 参数解释: 工作项计划开发结束日期,unix时间戳,单位:毫秒。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| workload | 否 | String | 参数解释: 工作项计划工时。 约束限制: 保留一位小数。 取值范围: 0~999999999.9。 默认取值: 不涉及。 |
| link | 否 | String | 参数解释: 工作项关联项ID。 约束限制: 多个关联项用英文逗号分隔,同一工作项最多支持50个关联项。 取值范围: 0~2048个字符。 默认取值: 不涉及。 |
| labels | 否 | Array of LabelEntity objects | 参数解释: 工作项标签。数组元素为LabelEntity对象。 约束限制: 不涉及。 取值范围: 0~50个元素,每个元素为LabelEntity对象。 默认取值: 不涉及。 |
| custom_fields | 否 | Array of FieldCodeValuePair objects | 参数解释: 工作项自定义字段映射,用户添加的系统字段也在此列,结构如下:{"code":"字段code","value":"字段值"}。数组元素为FieldCodeValuePair对象。 约束限制: 不涉及。 取值范围: 0~200个元素,每个元素为FieldCodeValuePair对象。 默认取值: 不涉及。 |
| ir2feature | 否 | String | 参数解释: IR和SF的关联字段。 约束限制: IR可以填写该字段。 取值范围: 不涉及。 默认取值: 不涉及。 |
| need_break | 否 | String | 参数解释: 工作项是否需要分解。 约束限制: 仅可以分解的工作项类型有此字段。 取值范围: 默认取值: 不涉及。 |
| baseline | 否 | String | 参数解释: 工作项基线状态。 约束限制: 不涉及。 取值范围: 默认取值: 不涉及。 |
| priority | 否 | String | 参数解释: 工作项优先级,部分工作项有此字段。 约束限制: 不涉及。 取值范围: 默认取值: 不涉及。 |
| related_network_security | 否 | String | 参数解释: 是否涉及网络安全。 约束限制: 预设字段中,仅研发需求类型的工作项有此字段。 取值范围: 默认取值: 不涉及。 |
| business_domain | 否 | String | 参数解释: 领域字段。 约束限制: 不涉及。 取值范围: 默认取值: 不涉及。 |
| plan_pi | 否 | String | 参数解释: 工作项发布计划ID,在Bug中为修复发布计划ID。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=PI的对象的id字段就是迭代计划的ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| plan_iteration | 否 | String | 参数解释: 工作项完成的迭代计划ID,在Bug中为修复迭代计划ID。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=Iteration的对象的id字段就是迭代计划的ID。 约束限制: 18~19个字符的数字字符串。 取值范围: 不涉及。 默认取值: 不涉及。 |
| no_break_reason | 否 | String | 参数解释: 无需分解原因。 约束限制: need_break字段值为“no”时有此字段。 取值范围: 0~512个字符。 默认取值: 不涉及。 |
| submitted_by | 否 | Array of UserUpdateAttribute objects | 参数解释: 工作项提出人。数组元素为UserUpdateAttribute对象。 约束限制: 不涉及。 |
| ir2rr | 否 | String | 参数解释: IR关联的RR ID,可以通过查询工作项列表或者查询树状工作项接口获取,响应消息体中的id字段的值就是工作项ID。 约束限制: 多个关联项ID使用英文逗号分隔。 取值范围: 0~1024个字符。 默认取值: 不涉及。 |
| feature_set | 否 | String | 参数解释: 所属特性集ID,可以通过查询特性集接口获取,响应消息体中的id字段的值就是特性集ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| expected_repair_date | 否 | String | 参数解释: 期望修复时间。预设字段中,仅Bug有此字段,unix时间戳,单位:毫秒。 约束限制: 不涉及。 取值范围: 11~19个字符。 默认取值: 不涉及。 |
| found_pi | 否 | String | 参数解释: 缺陷发现发布计划ID,预设字段中,仅Bug有此字段。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=PI的对象的id字段就是迭代计划的ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| found_iteration | 否 | String | 参数解释: 缺陷发现迭代计划ID,预设字段中,仅Bug有此字段。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=Iteration的对象的id字段就是迭代计划的ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| reason_analysis | 否 | String | 参数解释: 分析原因。 约束限制: 预设字段中,仅Bug有此字段。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| repair_solution | 否 | String | 参数解释: 修复方案。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| test_report | 否 | String | 参数解释: 测试报告。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| sys_no_repair_reason | 否 | String | 参数解释: 无需修复原因。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| sys_activation_reason | 否 | String | 参数解释: 激活原因。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| sys_return_reason | 否 | String | 参数解释: 退回原因。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| test_failures_times | 否 | Integer | 参数解释: 回归不通过次数。预设字段中,仅Bug有此字段。 约束限制: 不涉及。 取值范围: 0~999999。 默认取值: 不涉及。 |
| close_type | 否 | String | 参数解释: 关闭类型。 约束限制: 不涉及。 取值范围: 默认取值: 不涉及。 |
| plan_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项规划责任人。负责工作项的规划和计划制定。 约束限制: 不涉及。 |
| doing_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项实现责任人。负责工作项的具体实现和执行。 约束限制: 不涉及。 |
| delivered_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项交付责任人。负责工作项的交付和发布。 约束限制: 不涉及。 |
| checking_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项验收责任人。负责工作项的最终验收确认。 约束限制: 不涉及。 |
| test_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项测试责任人。负责工作项的测试验证。 约束限制: 不涉及。 |
| develop_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项开发责任人。负责工作项的开发实现。 约束限制: 不涉及。 |
| processing_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项处理中责任人。负责工作项的当前处理阶段。 约束限制: 不涉及。 |
| fixed_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项修复责任人。负责工作项的问题修复。 约束限制: 不涉及。 |
| researchanddevelop_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项研发责任人。负责工作项的研发工作。 约束限制: 不涉及。 |
| analyse_owner | 否 | UserUpdateAttribute object | 参数解释: 工作项分析责任人。负责工作项的需求分析和技术分析。 约束限制: 不涉及。 |
| plan_start_date | 否 | String | 参数解释: 计划开始时间。工作项的计划启动日期,用于项目进度管理和排期。 约束限制: 不涉及。 取值范围: 11~19个字符的时间戳字符串,单位为毫秒(ms)。 默认取值: 不涉及。 |
| expect_delivery_time | 否 | String | 参数解释: 期望完成时间。工作项的预期交付日期,用于跟踪工作项是否按期完成。 约束限制: 不涉及。 取值范围: 11~19个字符的时间戳字符串,单位为毫秒(ms)。 默认取值: 不涉及。 |
| plan_test_end_date | 否 | String | 参数解释: 计划测试结束时间。Bug类型工作项的计划测试完成日期,用于跟踪Bug修复后的测试进度。 约束限制: 仅对Bug类型工作项生效,非Bug类型忽略此字段。 取值范围: 11~19个字符的时间戳字符串,单位为毫秒(ms)。 默认取值: 不涉及。 |
| severity | 否 | String | 参数解释: 严重程度。Bug类型工作项的严重级别,用于评估Bug的影响范围和修复优先级。 约束限制: 仅对Bug类型工作项生效,非Bug类型忽略此字段。 取值范围: 默认取值: 不涉及。 |
| promised | 否 | String | 参数解释: 是否承诺。RR(原始需求)类型工作项的承诺状态标识,用于标记需求是否已承诺交付。 约束限制: 仅对RR类型工作项生效,非RR类型忽略此字段。 取值范围: 默认取值: 不涉及。 |
| recipient | 否 | Array of UserUpdateAttribute objects | 参数解释: 承接人。RR(原始需求)类型工作项的需求承接责任人,负责需求的分析和转化。 约束限制: 仅对RR类型工作项生效,非RR类型忽略此字段。 |
| sys_no_develop_reason | 否 | String | 参数解释: 无需研发原因。RR(原始需求)类型工作项不需要进行研发的原因说明。 约束限制: 仅对RR类型工作项生效,非RR类型忽略此字段。 取值范围: 0~50000个字符。 默认取值: 不涉及。 |
| val_feature | 否 | String | 参数解释: 价值特性。SF/FE类型工作项对应的业务价值特性描述,用于关联业务价值和技术实现。 约束限制: 仅对SF/FE类型工作项生效,其他类型忽略此字段。 取值范围: 默认取值: 不涉及。 |
| function_scene | 否 | String | 参数解释: 功能场景。SF/FE类型工作项的功能应用场景描述,用于说明特性的使用场景和用户故事。 约束限制: 仅对SF/FE类型工作项生效,其他类型忽略此字段。 取值范围: 0~512个字符。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| id | 否 | String | 参数解释: 标签ID,可通过查询标签列表接口获取,响应消息体中的id字段的值就是标签ID。 约束限制: 不涉及。 取值范围: 18~19个字符的数字字符串。 默认取值: 不涉及。 |
| category_types | 否 | Array of strings | 参数解释: 标签所属工作项类型编码。 约束限制: 不涉及。 默认取值: 不涉及。 |
| label_type | 否 | String | 参数解释: 标签所属工作项类型,对应工作项的type字段,枚举类型。 约束限制: 不涉及。 取值范围: 默认取值: 不涉及。 |
| color | 否 | String | 参数解释: 标签颜色RGB。 约束限制: 0~16个字符。 取值范围: 可选颜色代码与对应中文描述如下: 默认取值: 不涉及。 |
| title | 否 | String | 参数解释: 标签标题。 约束限制: 1~30个字符。 取值范围: 不涉及。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| code | 否 | String | 参数解释: 工作项自定义字段code值。可选值可以通过查询字段模板列表接口获取,响应体中的code就是字段唯一标识。 约束限制: 0~32个字符。 取值范围: 不涉及。 默认取值: 不涉及。 |
| value | 否 | String | 参数解释: 工作项自定义字段值。 约束限制: 为多选时用英文逗号分隔。 取值范围: 不涉及。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| id | 否 | String | 参数解释: 用户ID,可通过查询项目成员列表接口获取,响应消息体中的id字段的值就是用户ID。 约束限制: 不涉及。 取值范围: 不涉及。 默认取值: 不涉及。 |
| name | 否 | String | 参数解释: 用户名称。 约束限制: 当id属性有值时,优先使用id和项目成员进行匹配,匹配失败再按name匹配。 取值范围: 2~64个字符。 默认取值: 不涉及。 |
| nick_name | 否 | String | 参数解释: 用户昵称。 约束限制: 当id,name属性有值时,优先使用id,name和项目成员进行匹配,匹配失败再按nick_name匹配。 取值范围: 2~30个字符。 默认取值: 不涉及。 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| result | Array of IssueBatchOperateEntitiesResult objects | 参数解释: 批量编辑的结果。 |
| status | String | 参数解释: 返回状态。 取值范围: |
| message | String | 参数解释: 操作失败原因。 取值范围: 不涉及 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| success | Array of IssueOperateResult objects | 参数解释: 成功的结果。 |
| failed | Array of IssueOperateResult objects | 参数解释: 失败的结果。 |
| undeleted_trees | Array of IssueOperateResult objects | 参数解释: 删除失败的工作项。 取值范围: 不涉及 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 参数解释: 变更的工作项ID。 取值范围: 不涉及 |
| operator | String | 参数解释: 工作项变更人ID。 取值范围: 不涉及 |
| state | String | 参数解释: 工作项的作废标识,枚举类型。 取值范围: |
| operate_time | String | 参数解释: 工作项变更时间。 取值范围: 不涉及 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 参数解释: 错误码。 取值范围: 不涉及。 |
| error_msg | String | 参数解释: 错误描述,对error_code的补充解释。 取值范围: 不涉及。 |
请求示例
批量更新研发需求
PUT https://{endpoint}/v1/ipdprojectservice/projects/8e70d806a8f04d018ea6af6b6ffe7b96/issues/batch
{
"id" : [ "957294446158852096", "957315051394478080" ],
"attribute" : {
"category" : "IR",
"priority" : "低",
"submitted_by" : [ {
"id" : "a360371833bf4c558f796fd707b44daf"
} ],
"labels" : [ {
"id" : "956308025419804673"
}, {
"id" : "956308025419804673"
} ],
"custom_fields" : [ {
"code" : "c7073388365101674496",
"value" : "881467547473321986,881467547473321987"
}, {
"code" : "c7148504958125613056",
"value" : "我是一个项目自定义字段"
}, {
"code" : "module",
"value" : "956584293264568320"
}, {
"code" : "c7148512434669625344",
"value" : "956591616891461634"
} ]
}
} 响应示例
状态码:200
{
"status" : "success",
"result" : [ {
"success" : [ {
"id" : "957294446158852096",
"operator" : "a360371833bf4c558f796fd707b44daf",
"operate_time" : "1706607114000"
}, {
"id" : "957315051394478080",
"operator" : "a360371833bf4c558f796fd707b44daf",
"operate_time" : "1706607114000"
} ],
"failed" : [ ]
} ]
} 状态码:400
{
"error_code" : "PM.02175202",
"error_msg" : "工作项在变更评审中"
} 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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | 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.*; import java.util.List; import java.util.ArrayList; public class BatchUpdateIpdIssuesSolution { 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(); BatchUpdateIpdIssuesRequest request = new BatchUpdateIpdIssuesRequest(); request.withProjectId("{project_id}"); BatchUpdateIssuesParam body = new BatchUpdateIssuesParam(); List<UserUpdateAttribute> listAttributeSubmittedBy = new ArrayList<>(); listAttributeSubmittedBy.add( new UserUpdateAttribute() .withId("a360371833bf4c558f796fd707b44daf") ); List<FieldCodeValuePair> listAttributeCustomFields = new ArrayList<>(); listAttributeCustomFields.add( new FieldCodeValuePair() .withCode("c7073388365101674496") .withValue("881467547473321986,881467547473321987") ); listAttributeCustomFields.add( new FieldCodeValuePair() .withCode("c7148504958125613056") .withValue("我是一个项目自定义字段") ); listAttributeCustomFields.add( new FieldCodeValuePair() .withCode("module") .withValue("956584293264568320") ); listAttributeCustomFields.add( new FieldCodeValuePair() .withCode("c7148512434669625344") .withValue("956591616891461634") ); List<LabelEntity> listAttributeLabels = new ArrayList<>(); listAttributeLabels.add( new LabelEntity() .withId("956308025419804673") ); listAttributeLabels.add( new LabelEntity() .withId("956308025419804673") ); IssueUpdateAttribute attributebody = new IssueUpdateAttribute(); attributebody.withCategory("IR") .withLabels(listAttributeLabels) .withCustomFields(listAttributeCustomFields) .withPriority("低") .withSubmittedBy(listAttributeSubmittedBy); List<String> listbodyId = new ArrayList<>(); listbodyId.add("957294446158852096"); listbodyId.add("957315051394478080"); body.withAttribute(attributebody); body.withId(listbodyId); request.withBody(body); try { BatchUpdateIpdIssuesResponse response = client.batchUpdateIpdIssues(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 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | # 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 = BatchUpdateIpdIssuesRequest() request.project_id = "{project_id}" listSubmittedByAttribute = [ UserUpdateAttribute( id="a360371833bf4c558f796fd707b44daf" ) ] listCustomFieldsAttribute = [ FieldCodeValuePair( code="c7073388365101674496", value="881467547473321986,881467547473321987" ), FieldCodeValuePair( code="c7148504958125613056", value="我是一个项目自定义字段" ), FieldCodeValuePair( code="module", value="956584293264568320" ), FieldCodeValuePair( code="c7148512434669625344", value="956591616891461634" ) ] listLabelsAttribute = [ LabelEntity( id="956308025419804673" ), LabelEntity( id="956308025419804673" ) ] attributebody = IssueUpdateAttribute( category="IR", labels=listLabelsAttribute, custom_fields=listCustomFieldsAttribute, priority="低", submitted_by=listSubmittedByAttribute ) listIdbody = [ "957294446158852096", "957315051394478080" ] request.body = BatchUpdateIssuesParam( attribute=attributebody, id=listIdbody ) response = client.batch_update_ipd_issues(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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | 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, err := basic.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). SafeBuild() if err != nil { fmt.Println(err) return } hcClient, err := projectman.ProjectManClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). SafeBuild() if err != nil { fmt.Println(err) return } client := projectman.NewProjectManClient(hcClient) request := &model.BatchUpdateIpdIssuesRequest{} request.ProjectId = "{project_id}" idSubmittedBy:= "a360371833bf4c558f796fd707b44daf" var listSubmittedByAttribute = []model.UserUpdateAttribute{ { Id: &idSubmittedBy, }, } codeCustomFields:= "c7073388365101674496" valueCustomFields:= "881467547473321986,881467547473321987" codeCustomFields1:= "c7148504958125613056" valueCustomFields1:= "我是一个项目自定义字段" codeCustomFields2:= "module" valueCustomFields2:= "956584293264568320" codeCustomFields3:= "c7148512434669625344" valueCustomFields3:= "956591616891461634" var listCustomFieldsAttribute = []model.FieldCodeValuePair{ { Code: &codeCustomFields, Value: &valueCustomFields, }, { Code: &codeCustomFields1, Value: &valueCustomFields1, }, { Code: &codeCustomFields2, Value: &valueCustomFields2, }, { Code: &codeCustomFields3, Value: &valueCustomFields3, }, } idLabels:= "956308025419804673" idLabels1:= "956308025419804673" var listLabelsAttribute = []model.LabelEntity{ { Id: &idLabels, }, { Id: &idLabels1, }, } categoryAttribute:= "IR" priorityAttribute:= "低" attributebody := &model.IssueUpdateAttribute{ Category: &categoryAttribute, Labels: &listLabelsAttribute, CustomFields: &listCustomFieldsAttribute, Priority: &priorityAttribute, SubmittedBy: &listSubmittedByAttribute, } var listIdbody = []string{ "957294446158852096", "957315051394478080", } request.Body = &model.BatchUpdateIssuesParam{ Attribute: attributebody, Id: listIdbody, } response, err := client.BatchUpdateIpdIssues(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | 错误原因 |
错误码
请参见错误码。