创建变更评审单(BR/GR) - CreateIpdProcessInstance
功能介绍
创建变更评审单,适用于基线评审(BR)和通用评审(GR)单
调用方法
请参见如何调用API。
授权信息
账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项。
URI
POST /v1/ipdprojectservice/projects/{project_id}/process-instances
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 参数解释: 项目32位ID,项目唯一标识。通过查询IPD项目列表获取,响应消息体中的id字段的值就是项目ID。 约束限制: 不涉及。 取值范围: 32个字符,由英文字母和数字组成。 默认取值: 不涉及。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| operate_type | 否 | String | 操作类型 |
| domain_id | 否 | String | 提出项目的domainId |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| title | 是 | String | 标题 |
| description | 是 | String | 描述 |
| category | 是 | String | 类别 |
| need_approval | 否 | Boolean | 是否需要决策人审批 |
| plan_end_date | 否 | String | 计划完成日期时间戳,不可早于计划开始日期 |
| plan_start_date | 否 | String | 计划开始日期时间戳,不可晚于计划完成日期 |
| status | 是 | String | 状态 |
| cc | 否 | Array of strings | 抄送人列表 |
| attachWikis | 否 | Array of strings | 关联wiki |
| attachDocuments | 否 | Array of strings | 关联文件 |
| ccbs | 否 | Array of ccbs objects | 决策人 |
| opinions | 否 | Array of opinions objects | 评审专家 |
| cos | 否 | Array of cos objects | 评审对象 |
| local_attachment_names | 否 | Array of strings | 关联文件名 |
响应参数
状态码:200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| status | String | 参数解释: 返回状态。 取值范围: success:响应成功。 error:响应失败 |
| message | String | 返回消息 |
| result | result object | 返回结果 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| cc | String | 抄送人列表 |
| approver | String | 决策人ID |
| description | String | 评审单描述,列表接口不返回描述信息 |
| closed_time | String | 评审单完成时间 |
| reviewer | String | 评审专家ID,逗号分隔 |
| type | String | 类型 |
| title | String | 评审单标题 |
| modified_date | String | 评审单最后修改时间戳 |
| created_by | created_by object | 评审单创建人 |
| domain_id | String | 租户id |
| number | String | 评审单编号 |
| need_approval | Boolean | 是否需要审批 |
| br2co | String | 基线评审对象 |
| modified_by | modified_by object | 评审单最后修改人 |
| approval_time | String | 评审时间 |
| plan_end_date | String | 计划完成时间 |
| id | String | 评审单ID |
| state | String | 评审单工作状态,取值为"正在工作","作废" |
| created_date | String | 创建时间 |
| category | String | 类别 |
| plan_start_date | String | 计划开始时间 |
| review_config | review_config object | 评审配置 |
| status | status object | 评审单状态 |
| stage | String | 阶段 |
| opinions | Array of opinions objects | 变更对象评审专家Id列表(创建变更评审时使用) |
| opinion_comments | Array of strings | 评审意见 |
| attachments | Array of strings | 附件 |
| wikis | Array of strings | 关联wiki |
| associatedocuments | Array of strings | 关联文档 |
| cos | Array of cos objects | 评审对象列表 |
| approval_phase_result | String | 评审结果 |
| ccbs | Array of ccbs objects | 审批信息列表 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名称 |
| nick_name | String | 用户昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像 |
| region | String | 区域 |
| opinion | String | 意见 |
| description | String | 描述 |
| owner | String | 责任人 |
| ccbId | String | 评审id |
| has_removed | String | 是否已移出项目 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名称 |
| nick_name | String | 用户昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像 |
| region | String | 区域 |
| opinion | String | 意见 |
| description | String | 描述 |
| owner | String | 责任人 |
| ccbId | String | 评审id |
| has_removed | String | 是否已移出项目 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| approval_type | Integer | 审批类型 |
| ratio_value | String | 审批进度 |
| skip_decisioning | Boolean | 是否跳过决策 |
| approval_roles | String | 决策角色 |
| review_roles | String | 审批角色 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | id |
| type | String | 类型 |
| state | String | 状态 |
| status | String | 状态 |
| region | String | 区域 |
| category | String | 类型 |
| title | String | 标题 |
| rounds | String | 范围 |
| opinion | String | 观察者 |
| description | String | 描述 |
| modified_by | String | 修改人 |
| modified_date | String | 修改时间 |
| created_by | created_by object | 创建人 |
| created_date | String | 创建时间 |
| tenant_id | String | 租户id |
| domain_id | String | 项目ID |
| issue_category | String | 工作项类型 |
| issue_id | String | 工作项ID |
| curr_owner | curr_owner object | 当前责任人 |
| co_id | String | 变更对象id |
| user_id | String | 用户ID |
| opinion_issue_id | String | 评审工作项ID |
| opinion_issue_category | String | 评审工作项类型 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名称 |
| nick_name | String | 昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像 |
| region | String | 区域 |
| opinion | String | 意见 |
| description | String | 描述 |
| owner | String | 责任人 |
| ccbId | String | 评审id |
| has_removed | String | 是否已移出项目 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名 |
| nick_name | String | 昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像 |
| region | String | 区域 |
| opinion | String | 意见 |
| description | String | 描述 |
| owner | String | 责任人 |
| ccbId | String | 评审id |
| has_removed | String | 是否已移出项目 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| region | String | 区域 |
| category | String | 变更对象工作项类型,此处固定为CO |
| title | String | 评审单标题 |
| status | String | 变更对象状态 |
| assignee | assignee object | 评审单抄送人 |
| description | String | 评审单描述 |
| number | String | 变更对象关联的工作项编号 |
| order | String | 排序 |
| co2cr | String | 关联的变更评审标识 |
| co2br | String | 关联的基线评审标识 |
| co2gr | String | 关联的通用评审标识 |
| id | String | 审批对象Id |
| type | String | 评审单类型 |
| state | String | 评审单工作状态,取值为"正在工作","作废" |
| before_change | String | 变更对象工作项修改前内容 |
| after_change | String | 变更对象修改后内容 |
| modified_by | String | 评审单最后修改人 |
| modified_date | String | 评审单最后修改时间 |
| created_by | String | 评审单创建人 |
| created_date | String | 评审单创建时间 |
| tenant_id | String | 工作项所属租户ID,可通过查询树状工作项接口获取,响应消息体中的tenant_id字段的值就是工作项所属租户id |
| status_map | String | 工作项状态 |
| domain_id | String | 租户id |
| source_system | String | 源系统 |
| source_system_link | String | 源系统链接 |
| issue_category | String | 变更对象关联的工作项类型 |
| issue_id | String | 工作项ID |
| issue_status | issue_status object | 工作项状态 |
| issue_severity | String | 工作项严重程度 |
| issue_priority | issue_priority object | 工作项优先级 |
| domain_title | String | 归属项目名称 |
| src_domain_title | String | 提出项目名称 |
| issue_assignee_name | String | 责任人昵称 |
| change_reason | String | 评审原因 |
| change_type | String | 评审类型 |
| source_system_id | String | 源系统id |
| change_description | String | 评审描述 |
| has_deleted | String | 是否已删除 |
| approval_phase_result | String | 评审结果 |
| approval_complete_time | String | 评审完成时间 |
| ccb_description | String | 评审描述 |
| actual_ccb | String | 评审专家 |
| ccbs | String | 审批信息列表 |
| ccb_info | String | 评审信息 |
| opinions | String | 变更对象评审专家Id列表(创建变更评审时使用) |
| opinion_comments | String | 评审意见 |
| approval_time | String | 审批时间 |
| src_domain_id | String | 租户id |
| cross_domain | String | 是否跨租户 |
| domain_moved | String | 归属项目是否迁移 |
| reviewer | Array of strings | 评审专家 |
| approver | Array of strings | 决策人 |
| rounds | String | 评审轮次 |
| last_round_result | String | 最近一轮决策结果 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名 |
| nick_name | String | 用户昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像 |
| region | String | 区域 |
| opinion | String | 评审信息 |
| description | String | 描述 |
| owner | String | 当前处理人 |
| ccbId | String | 评审对象id |
| has_removed | String | 用户是否已移出项目 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | 状态id |
| belonging | String | 参数解释: 工作项的状态属性。 取值范围: START、IN_PROGRESS、END。 |
| space_id | String | 空间id |
| name | String | 状态名称 |
| code | String | 状态码 |
| definition_type | String | 定义类型 |
| belong_definition_type | Integer | 所属字段定义类型 |
| display_value | String | 显示值 |
| position | Integer | 排序位置 |
| displayable | Integer | 可显示 |
| editable | Integer | 可编辑 |
| deletable | Integer | 可删除 |
| mutable | Integer | 可变的 |
| title_py | String | 状态拼音 |
| created_by | String | 状态创建人 |
| created_date | String | 状态创建时间 |
| modified_date | String | 状态最后修改时间 |
| modified_by | String | 状态最后修改人 |
| linkage_node_fields | Boolean | 是否链接节点字段 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| id | String | id |
| display_value | String | 显示名称 |
| value | String | 值 |
| code | String | 编码 |
| value_py | String | 值(拼音首字母) |
| sequence | Integer | 序列 |
| level | Integer | 层级 |
| domain_id | String | 项目ID |
| belong_definition_type | String | 所属定义级别 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| watcher | String | 观察者 |
| user_id | String | 用户ID |
| user_num_id | String | 用户数字id |
| user_name | String | 用户名 |
| domain_id | String | 租户id |
| domain_name | String | 租户名 |
| nick_name | String | 用户昵称 |
| role_id | String | 角色id |
| role_name | String | 角色名 |
| image_id | String | 用户头像id |
| region | String | 区域 |
| opinion | String | 评审信息 |
| description | String | 描述信息 |
| owner | String | 当前处理人 |
| ccbId | String | 评审对象id |
| has_removed | String | 用户已移出项目 |
状态码:400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 参数解释: 错误码。 取值范围: 不涉及。 |
| error_msg | String | 参数解释: 错误描述,对error_code的补充解释。 取值范围: 不涉及。 |
请求示例
创建基线评审单
POST https://{endpoint}/v1/ipdprojectservice/projects/{project_id}/process-instances
{
"title" : "BR",
"description" : "<p><strong>【基线评审背景】</strong></p><p><br></p><p><strong>【基线评审价值】</strong></p><p><br></p><p><strong>【基线评审详情】</strong></p><br>",
"category" : "BR",
"need_approval" : true,
"status" : "ToBeReviewed",
"cc" : [ ],
"attachWikis" : [ ],
"attachDocuments" : [ ],
"ccbs" : [ {
"user_id" : "09d25f5d3f80d2881fd7c008ecf1622b"
} ],
"opinions" : [ {
"user_id" : "09d25f5d3f80d2881fd7c008ecf1622b",
"curr_owner" : "09d25f5d3f80d2881fd7c008ecf1622b"
} ],
"cos" : [ {
"number" : "IR20250716625228",
"issue_id" : "1152322333787987968",
"issue_category" : "IR",
"change_type" : "Modify",
"before_change" : "{\"view\":{}}",
"after_change" : "{\"view\":{},\"execute\":{}}"
} ],
"local_attachment_names" : [ ]
} 响应示例
状态码:200
OK
{
"status" : "success",
"result" : {
"id" : "1073568012549795840",
"number" : "CR20241211782294",
"state" : "正在工作",
"title" : "21-CR-10x",
"category" : "CR",
"created_by" : {
"id" : "a360371833bf4c558f796fd707b44daf",
"name" : "devcloud_devcloud_01",
"nick_name" : "测试账号"
},
"modified_by" : {
"id" : "a360371833bf4c558f796fd707b44daf",
"name" : "devcloud_devcloud_01",
"nick_name" : "测试账号"
},
"created_time" : "1733888160000",
"modified_time" : "1733888160000",
"plan_end_date" : "1735574400000",
"plan_start_date" : "1733673600000",
"need_approval" : "true",
"status" : {
"display_value" : "待评审",
"code" : "ToBeReviewed"
},
"description" : "<p><strong>【变更评审背景】</strong></p><p>1</p><p><strong>【变更评审价值】</strong></p><p><br></p><p><strong>【变更评审详情】</strong></p>",
"cos" : [ {
"after_change" : "{\"view\":{\"description\":\"<p>【故障现象描述】</p><p>x</p><p>【环境信息】</p><p><br></p><p>【故障现场定位开发人员】</p><p><br></p><p>【开发定位初步原因】</p>\"},\"execute\":{\"description\":\"<p>【故障现象描述】</p><p>x</p><p>【环境信息】</p><p><br></p><p>【故障现场定位开发人员】</p><p><br></p><p>【开发定位初步原因】</p>\"},\"snapshot\":{\"found_iteration\":null,\"type\":\"bug\",\"test_failures_times\":\"0\",\"number\":\"BUG20241209780441\",\"convolution_actual_hours\":null,\"path\":\"/1072968362439385089\",\"workload_man_day\":null,\"id\":\"1072968362439385089\",\"state\":\"正在工作\",\"sys_no_repair_reason\":null,\"module\":null,\"priority\":null,\"found_env\":null,\"sys_activation_reason\":null,\"assignee\":{\"watcher\":0,\"user_id\":\"a360371833bf4c558f796fd707b44daf\",\"user_num_id\":4091,\"user_name\":\"devcloud_devcloud_01\",\"domain_id\":\"4e919d73499648e3b0292cd3cbef806a\",\"domain_name\":\"devcloud_devcloud_01\",\"nick_name\":\"测试账号\",\"role_id\":\"257bbf34272649dd909bb35dfe27d126,05d9444b66cc4d5090ef3180a3096c91\",\"role_name\":\"项目经理,项目管理员\",\"role_alias_name\":\"Project manager,Project admin\",\"role_code\":\"Project manager,project_admin\",\"image_id\":\"\",\"region\":\"\",\"has_removed\":\"\"},\"close_type\":null,\"status\":{\"id\":\"1072203303913304105\",\"belonging\":\"START\",\"space_id\":\"1072203303493873664\",\"name\":\"分析\",\"status_category\":\"\",\"code\":\"Analyse\",\"definition_type\":\"5\",\"belong_definition_type\":3,\"belong_scope\":\"\",\"display_value\":\"分析\",\"position\":2,\"displayable\":1,\"editable\":1,\"deletable\":1,\"mutable\":1,\"title_py\":\"fx\",\"builtin\":false,\"label\":\"\",\"description\":\"\",\"created_by\":\"a360371833bf4c558f796fd707b44daf\",\"created_userinfo\":null,\"created_on\":\"\",\"created_date\":1733591588000,\"modified_date\":1733591588000,\"modified_by\":\"a360371833bf4c558f796fd707b44daf\",\"category_code\":[],\"editing_fields\":[],\"associate\":null,\"linkage_node_fields\":false},\"tenant_id\":\"4e919d73499648e3b0292cd3cbef806a\",\"plan_pi\":null,\"repair_solution\":null,\"plan_end_date\":null,\"expected_repair_date\":null,\"plan_iteration\":null,\"cascade_delete\":\"none\",\"issue_opinion_id\":null,\"modified_by\":{\"watcher\":0,\"user_id\":\"a360371833bf4c558f796fd707b44daf\",\"user_num_id\":4091,\"user_name\":\"devcloud_devcloud_01\",\"domain_id\":\"4e919d73499648e3b0292cd3cbef806a\",\"domain_name\":\"devcloud_devcloud_01\",\"nick_name\":\"测试账号\",\"role_id\":\"257bbf34272649dd909bb35dfe27d126,05d9444b66cc4d5090ef3180a3096c91\",\"role_name\":\"项目经理,项目管理员\",\"role_alias_name\":\"Project manager,Project admin\",\"role_code\":\"Project manager,project_admin\",\"image_id\":\"\",\"region\":\"\",\"has_removed\":\"\"},\"position_float\":\"10000000000.0000000000\",\"belong_inside\":\"1\",\"regression_failure_number\":\"0\",\"src_domain\":{\"id\":\"1072203303493873664\",\"name\":\"beta-m2-wyl-021\",\"title\":\"beta-m2-wyl-021\",\"project_id\":\"b248a70bc6434e6bad54c8e73a222dca\",\"parent_id\":\"\",\"category\":\"Project\",\"created_by\":\"a360371833bf4c558f796fd707b44daf\",\"model_id\":\"10002\",\"children\":[]},\"domain_id\":{\"id\":\"1072203303493873664\",\"name\":\"beta-m2-wyl-021\",\"title\":\"beta-m2-wyl-021\",\"project_id\":\"b248a70bc6434e6bad54c8e73a222dca\",\"parent_id\":\"\",\"category\":\"Project\",\"created_by\":\"a360371833bf4c558f796fd707b44daf\",\"model_id\":\"10002\",\"children\":[]},\"send_from\":\"\",\"send_to\":\"\",\"stay_days\":2,\"test_report\":null,\"assigned_cc\":null,\"return_reason\":null,\"submit_time\":1733745191791,\"workitem2label\":null,\"close_time\":null,\"modified_date\":1733887226000,\"created_by\":{\"watcher\":0,\"user_id\":\"a360371833bf4c558f796fd707b44daf\",\"user_num_id\":4091,\"user_name\":\"devcloud_devcloud_01\",\"domain_id\":\"4e919d73499648e3b0292cd3cbef806a\",\"domain_name\":\"devcloud_devcloud_01\",\"nick_name\":\"测试账号\",\"role_id\":\"257bbf34272649dd909bb35dfe27d126,05d9444b66cc4d5090ef3180a3096c91\",\"role_name\":\"项目经理,项目管理员\",\"role_alias_name\":\"Project manager,Project admin\",\"role_code\":\"Project manager,project_admin\",\"image_id\":\"\",\"region\":\"\",\"has_removed\":\"\"},\"activate_times\":\"0\",\"status_modified_date\":1733745192515,\"parent_id\":null,\"business_domain\":null,\"found_pi\":null,\"region\":\"example\",\"reason_analysis\":null,\"link\":\"\",\"is_suspended\":null,\"origin_id\":\"1072968362439385089\",\"change_status\":{\"id\":\"1072203303896526856\",\"display_value\":\"未变更\",\"value\":\"unchange\",\"code\":\"unchange\",\"value_py\":\"unchange\",\"sequence\":1.0,\"level\":1,\"domain_id\":\"1072203303493873664\",\"belong_definition_type\":\"5\"},\"title\":\"21-Bug-01\",\"sum_workload_man_day\":null,\"plan_start_date\":null,\"severity\":{\"id\":\"1072203303896526851\",\"display_value\":\"提示\",\"value\":\"提示\",\"code\":\"提示\",\"value_py\":\"ts\",\"sequence\":1.0,\"level\":1,\"domain_id\":\"1072203303493873664\",\"belong_definition_type\":\"5\"},\"convolution_plan_hours\":null,\"submitted_by\":[{\"watcher\":0,\"user_id\":\"a360371833bf4c558f796fd707b44daf\",\"user_num_id\":4091,\"user_name\":\"devcloud_devcloud_01\",\"domain_id\":\"4e919d73499648e3b0292cd3cbef806a\",\"domain_name\":\"devcloud_devcloud_01\",\"nick_name\":\"测试账号\",\"role_id\":\"257bbf34272649dd909bb35dfe27d126,05d9444b66cc4d5090ef3180a3096c91\",\"role_name\":\"项目经理,项目管理员\",\"role_alias_name\":\"Project manager,Project admin\",\"role_code\":\"Project manager,project_admin\",\"image_id\":\"\",\"region\":\"\",\"has_removed\":\"\"}],\"sys_return_reason\":null,\"issue_review_id\":null,\"created_date\":1733745192388,\"category\":\"Bug\",\"setup\":true,\"collaborative_status\":[],\"parent_status\":\"no\"}}",
"before_change" : "{\"view\":{\"description\":\"<p>【故障现象描述】</p><p><br></p><p>【环境信息】</p><p><br></p><p>【故障现场定位开发人员】</p><p><br></p><p>【开发定位初步原因】</p>\"}}",
"category" : "CO",
"ccbs" : [ {
"id" : "a360371833bf4c558f796fd707b44daf",
"name" : "devcloud_devcloud_01",
"nick_name" : "测试账号"
} ],
"change_type" : "Modify",
"co2review" : "1073568012549795840",
"created_by" : "a360371833bf4c558f796fd707b44daf",
"created_date" : "1733888157000",
"description" : "<p>【故障现象描述】</p><p>x</p><p>【环境信息】</p><p><br></p><p>【故障现场定位开发人员】</p><p><br></p><p>【开发定位初步原因】</p>",
"id" : "1073568002185670656",
"issue_id" : "1072968362439385089",
"issue_number" : "BUG20241209780441",
"issue_category" : "Bug",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"modified_date" : "1733888157000",
"opinions" : [ { } ],
"approver" : [ "a360371833bf4c558f796fd707b44daf" ],
"reviewer" : [ "a360371833bf4c558f796fd707b44daf" ],
"status" : "ToBeReviewed"
} ],
"cc" : [ {
"id" : "a360371833bf4c558f796fd707b44daf",
"name" : "devcloud_devcloud_01",
"nick_name" : "测试账号"
} ]
}
} 状态码:400
请求失败的响应。例如无操作权限、项目不存在。
{
"error_code" : "PM.02174103",
"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 | 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 CreateIpdProcessInstanceSolution { 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(); CreateIpdProcessInstanceRequest request = new CreateIpdProcessInstanceRequest(); request.withProjectId("{project_id}"); CreateProcessInstanceReq body = new CreateProcessInstanceReq(); List<CreateProcessInstanceReqCos> listbodyCos = new ArrayList<>(); listbodyCos.add( new CreateProcessInstanceReqCos() .withNumber("IR20250716625228") .withIssueId("1152322333787987968") .withIssueCategory("IR") .withChangeType("Modify") .withBeforeChange("{"view":{}}") .withAfterChange("{"view":{},"execute":{}}") ); List<CreateProcessInstanceReqOpinions> listbodyOpinions = new ArrayList<>(); listbodyOpinions.add( new CreateProcessInstanceReqOpinions() .withUserId("09d25f5d3f80d2881fd7c008ecf1622b") .withCurrOwner("09d25f5d3f80d2881fd7c008ecf1622b") ); List<CreateProcessInstanceReqCcbs> listbodyCcbs = new ArrayList<>(); listbodyCcbs.add( new CreateProcessInstanceReqCcbs() .withUserId("09d25f5d3f80d2881fd7c008ecf1622b") ); body.withCos(listbodyCos); body.withOpinions(listbodyOpinions); body.withCcbs(listbodyCcbs); body.withStatus("ToBeReviewed"); body.withNeedApproval(true); body.withCategory("BR"); body.withDescription("<p><strong>【基线评审背景】</strong></p><p><br></p><p><strong>【基线评审价值】</strong></p><p><br></p><p><strong>【基线评审详情】</strong></p><br>"); body.withTitle("BR"); request.withBody(body); try { CreateIpdProcessInstanceResponse response = client.createIpdProcessInstance(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 | # 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 = CreateIpdProcessInstanceRequest() request.project_id = "{project_id}" listCosbody = [ CreateProcessInstanceReqCos( number="IR20250716625228", issue_id="1152322333787987968", issue_category="IR", change_type="Modify", before_change="{"view":{}}", after_change="{"view":{},"execute":{}}" ) ] listOpinionsbody = [ CreateProcessInstanceReqOpinions( user_id="09d25f5d3f80d2881fd7c008ecf1622b", curr_owner="09d25f5d3f80d2881fd7c008ecf1622b" ) ] listCcbsbody = [ CreateProcessInstanceReqCcbs( user_id="09d25f5d3f80d2881fd7c008ecf1622b" ) ] request.body = CreateProcessInstanceReq( cos=listCosbody, opinions=listOpinionsbody, ccbs=listCcbsbody, status="ToBeReviewed", need_approval=True, category="BR", description="<p><strong>【基线评审背景】</strong></p><p><br></p><p><strong>【基线评审价值】</strong></p><p><br></p><p><strong>【基线评审详情】</strong></p><br>", title="BR" ) response = client.create_ipd_process_instance(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 | 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.CreateIpdProcessInstanceRequest{} request.ProjectId = "{project_id}" numberCos:= "IR20250716625228" issueIdCos:= "1152322333787987968" issueCategoryCos:= "IR" changeTypeCos:= "Modify" beforeChangeCos:= "{"view":{}}" afterChangeCos:= "{"view":{},"execute":{}}" var listCosbody = []model.CreateProcessInstanceReqCos{ { Number: &numberCos, IssueId: &issueIdCos, IssueCategory: &issueCategoryCos, ChangeType: &changeTypeCos, BeforeChange: &beforeChangeCos, AfterChange: &afterChangeCos, }, } userIdOpinions:= "09d25f5d3f80d2881fd7c008ecf1622b" currOwnerOpinions:= "09d25f5d3f80d2881fd7c008ecf1622b" var listOpinionsbody = []model.CreateProcessInstanceReqOpinions{ { UserId: &userIdOpinions, CurrOwner: &currOwnerOpinions, }, } userIdCcbs:= "09d25f5d3f80d2881fd7c008ecf1622b" var listCcbsbody = []model.CreateProcessInstanceReqCcbs{ { UserId: &userIdCcbs, }, } needApprovalCreateProcessInstanceReq:= true request.Body = &model.CreateProcessInstanceReq{ Cos: &listCosbody, Opinions: &listOpinionsbody, Ccbs: &listCcbsbody, Status: "ToBeReviewed", NeedApproval: &needApprovalCreateProcessInstanceReq, Category: "BR", Description: "<p><strong>【基线评审背景】</strong></p><p><br></p><p><strong>【基线评审价值】</strong></p><p><br></p><p><strong>【基线评审详情】</strong></p><br>", Title: "BR", } response, err := client.CreateIpdProcessInstance(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
更多
更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。
状态码
| 状态码 | 描述 |
|---|---|
| 200 | OK |
| 400 | 请求失败的响应。例如无操作权限、项目不存在。 |
错误码
请参见错误码。