Creating a Work Item as a User with Fine-grained Permissions
Function
Users who have been granted IAM fine grained permissions (projectmanConfig:systemSettingField:set) and can create work items in a project can set work item creators.
Calling Method
For details, see Calling APIs.
Authorization Information
Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.
URI
POST /v4/projects/{project_id}/system/issue
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition A 32-character UUID. It uniquely identifies a project. Obtain a project ID by calling the API for querying projects. The value of project_id in the response message body is a project ID. Constraints A string of 32 characters consisting of letters and digits. Range N/A Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints N/A Range The value contains 10 to 32,768 characters. Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| actual_work_hours | No | Double | Definition Actual workloads, automatically calculated by summing detailed workloads in a work item and its child work items. Constraints N/A Range ≥ 0 Default Value N/A |
| assigned_id | No | Integer | Definition Digital ID of the handler. You can obtain the digital ID of a user in a specified project using the API for obtaining the user list of a specified project. Constraints ≥ 1 digit Range ≥ 0 Default Value N/A |
| begin_time | No | String | Definition Start time: YYYY–MM–DD. Constraints The date is in the YYYY-MM-DD format, and the year ranges from 1000 to 9999. Range The value is a date string in the format of YYYY-MM-DD. MM is a two-digit month ranging from 01 to 12, and DD is a two-digit date ranging from 01 to 31. Default Value N/A |
| description | No | String | Definition Work item description. Constraints Can be left blank. Range A string of 1 to 200,000 characters. Default Value N/A |
| developer_id | No | Integer | Definition Digital ID of a developer. You can obtain the digital ID of a user in a specified project using the API for obtaining the user list of a specified project. Constraints ≥ 1 digit Range Min.: 0. Default Value N/A |
| domain_id | No | Integer | Definition Domain ID. Constraints One or more numeric digits. Range Default Value N/A |
| done_ratio | No | Integer | Definition Work item completion rate. Constraints If the input is 0, the completion rate of the work item is 0%. If the input is 100, the completion rate of the work item is 100%. Range 0–100 Default Value N/A |
| end_time | No | String | Definition End time: YYYY–MM–DD. Constraints The date is in the YYYY-MM-DD format, and the year ranges from 1000 to 9999. Range The value is a date string in the format of YYYY-MM-DD. MM is a two-digit month ranging from 01 to 12, and DD is a two-digit date ranging from 01 to 31. Default Value N/A |
| expected_work_hours | No | Double | Definition: Estimated workload. Constraints: This field can be left blank. Options: Minimum length: 0 characters. Default value: N/A |
| iteration_id | No | Integer | Definition Sprint ID, which can be obtained using the API for obtaining the sprint list of a specified project. The value of the id field in the response message body is the sprint ID. Constraints ≥ 1 digit Range Min. 0 characters. Default Value N/A |
| module_id | No | Integer | Definition Module ID, which is the value of id in the response body returned by the API for querying the project module list. Constraints ≥ 1 digit Range Min. 0 characters. Default Value N/A |
| name | Yes | String | Definition Title. Constraints Can be left blank. Range Length: 1 to 512 characters Default Value N/A |
| new_custom_fields | No | Array of NewCustomField objects | Definition: Custom field. Constraints: N/A |
| parent_issue_id | No | Integer | Definition Parent work item ID. Constraints This parameter is mandatory when you create a child work item. Obtained the value from the Performing Advanced Query of Work Items API. The value of the id field in the response body is the work item ID. Range ≥ 0 Default Value N/A |
| priority_id | Yes | Integer | Definition Priority. Constraints N/A Range Default Value N/A |
| severity_id | No | Integer | Definition Severity. Constraints N/A Range Default Value N/A |
| status_id | No | Integer | Definition Status ID. Constraints One or more numeric digits. Range Default Value N/A |
| tracker_id | Yes | Integer | Definition Work item type. Constraints An epic can only be the parent work item of a feature. A feature can only be the parent work item of a story. A story can only be the parent work item of a task or bug. Range Default Value N/A |
| assigned_cc | No | String | Definition CC user UUID. You can confirm the user UUID of a specific project member by calling the Obtaining the Member List of a Specified Project API. Constraints Multiple CC user UUIDs are concatenated by commas (,). Range N/A Default Value N/A |
| creator | Yes | Creator object | Definition: Creator. Constraints: N/A |
| custom_fields | No | Array of ScrumCustomField objects | Definition: Custom Scrum project fields. Constraints: N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| custom_field | No | String | Parameter description: Custom field. You can obtain the custom_field value returned using the [Querying Custom Fields of a Scrum Work Item]ListIssueCustomFields.xml) API. Constraints: This field can be left blank. Options: N/A Default value: N/A |
| field_name | No | String | Definition: Values of custom properties. Use commas (,) to separate multiple values, which can be obtained by querying the name value returned when calling the Querying Custom Fields of a Scrum Work Item API. Constraints: This field can be left blank. Value range: N/A Default value: N/A |
| value | No | String | Definition: Values of custom properties. Use commas (,) to separate multiple values. You can obtain the value by querying the options value returned when calling the Querying Custom Fields of a Scrum Work Item API. Constraints: This field can be left blank. Value range: N/A Default value: N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| actual_work_hours | Double | Definition Actual workloads. Range N/A |
| assigned_cc_user | Array of IssueUser objects | Definition: Cc recipient. |
| assigned_user | IssueUser object | Definition Handler. |
| begin_time | String | Definition: Start time: YYYY–MM–DD. Options: N/A |
| creator | IssueUser object | Definition: Creator. |
| custom_fields | Array of CustomField objects | Definition Custom property value, which is not recommended. Refer to the new_custom_fields field. |
| developer | IssueUser object | Definition: Developer. |
| domain | domain object | Definition 14: performance 15: function 16: reliability 17: cyber security 18: maintainability 19: other DFX 20: availability |
| done_ratio | Integer | Definition Work item progress value. Range N/A |
| end_time | String | Definition: End time: YYYY–MM–DD. Options: N/A |
| expected_work_hours | Double | Definition: Estimated workload. Options: N/A |
| id | Integer | Definition Work item ID. Range N/A |
| iteration | iteration object | Definition: Sprint. |
| module | module object | Definition: Module. |
| new_custom_fields | Array of NewCustomField objects | Definition: Custom attribute value. |
| parent_issue | parent_issue object | Definition: Parent work item. |
| priority | priority object | Definition Work item priority. 1: low 2: medium 3: high |
| project | IssueProjectResponseV4 object | Definition: Project information. |
| severity | severity object | Definition: Work item severity. |
| status | status object | Definition Work item status. 1: new 2: ongoing 3: solved 4: testing 5: closed 6: rejected |
| tracker | tracker object | Definition Work item type. 2 (task) 3 (bug) 5 (epic) 6 (feature) 7 (story) |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition User ID. Range N/A |
| name | String | Definition Username. Range N/A |
| nick_name | String | Definition: Alias. Options: N/A |
| user_id | String | Definition User UUID. Range N/A |
| user_num_id | Integer | Definition Digital ID of a user. Range N/A |
| first_name | String | Definition: Username. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| name | String | Definition: Custom property name. Value range: N/A |
| new_name | String | Definition: Custom property name. Value range: N/A |
| value | String | Definition: Value of the custom property. Value range: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Domain ID. Range N/A |
| name | String | Definition: Domain. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Sprint ID. Range N/A |
| name | String | Definition: Sprint name. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Module ID. Range N/A |
| name | String | Definition: Module. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| custom_field | String | Parameter description: Custom field. You can obtain the custom_field value returned using the [Querying Custom Fields of a Scrum Work Item]ListIssueCustomFields.xml) API. |
| field_name | String | Definition: Values of custom properties. Use commas (,) to separate multiple values, which can be obtained by querying the name value returned when calling the Querying Custom Fields of a Scrum Work Item API. |
| value | String | Definition: Values of custom properties. Use commas (,) to separate multiple values. You can obtain the value by querying the options value returned when calling the Querying Custom Fields of a Scrum Work Item API. |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Parent work item ID. Range N/A |
| name | String | Definition: Parent work item. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Priority ID. Range N/A |
| name | String | Definition: Priority. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| project_id | String | Definition Project ID. Range N/A |
| project_name | String | Definition: Project name. Value range: N/A |
| project_num_id | Integer | Definition Digital ID of a project. Range ≥ 0 |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Severity ID. Range N/A |
| name | String | Definition: Severity. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Status ID. Range N/A |
| name | String | Definition: Status name. Options: N/A |
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Definition Type ID. Range N/A |
| name | String | Definition: Type name. Options: N/A |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Value range: N/A |
| error_msg | String | Definition: Error description. Value range: N/A |
Status code: 401
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition: Error code. Value range: N/A |
| error_msg | String | Definition: Error description. Value range: N/A |
| request_id | String | Definition Request ID, which is automatically generated by the system. Range N/A |
Example Requests
POST https://{endpoint}/v4/projects/526cefde62004de2b62b5e8dd2c2b3af/system/issue
{
"assigned_id" : 4091,
"begin_time" : "2018-1-31",
"creator" : {
"user_id" : "a360371833bf4c558f796fd707b44daf"
},
"description" : "",
"developer_id" : 4091,
"end_time" : "2018-07-05",
"iteration_id" : 11302238,
"name" : "test",
"parent_issue_id" : 1679822,
"priority_id" : 2,
"severity_id" : 10,
"status_id" : 1,
"tracker_id" : 3
} Example Responses
Status code: 200
{
"actual_work_hours" : 0,
"assigned_cc_user" : [ {
"id" : 4091,
"name" : "demo_user_name",
"nick_name" : "bear"
} ],
"assigned_user" : {
"id" : 4091,
"name" : "demo_user_name",
"nick_name" : "bear"
},
"begin_time" : "2020-09-12",
"creator" : {
"id" : 4091,
"name" : "demo_user_name",
"nick_name" : "bear"
},
"custom_fields" : [ {
"name" : "customField16",
"value" : "Check box",
"new_name" : "custom_field16"
} ],
"new_custom_fields" : [ {
"custom_field" : "custom_field16",
"field_name" : "field_name",
"value" : "Check box 1, Check box 2"
} ],
"developer" : {
"id" : 4091,
"name" : "demo_user_name",
"nick_name" : "bear1"
},
"domain" : {
"id" : 14,
"name" : "Performance"
},
"done_ratio" : 0,
"end_time" : "2020-09-19",
"expected_work_hours" : 9,
"id" : 4567,
"project" : {
"project_id" : "526cefde62004de2b62b5e8dd2c2b3af",
"project_name" : "testDemo",
"project_num_id" : 78953
},
"iteration" : {
"id" : 456,
"name" : "Sprint 1"
},
"module" : {
"id" : 456,
"name" : "Project"
},
"parent_issue" : {
"id" : 123,
"name" : "parentIssue"
},
"priority" : {
"id" : 1,
"name" : "Low"
},
"severity" : {
"id" : 12,
"name" : "Minor"
},
"status" : {
"id" : 1,
"name" : "New"
},
"tracker" : {
"id" : 7,
"name" : "story"
}
} SDK Sample Code
The SDK sample code is as follows.
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 | 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 CreateSystemIssueV4Solution { 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(); CreateSystemIssueV4Request request = new CreateSystemIssueV4Request(); request.withProjectId("{project_id}"); CreateSystemIssueRequestV4 body = new CreateSystemIssueRequestV4(); Creator creatorbody = new Creator(); creatorbody.withUserId("a360371833bf4c558f796fd707b44daf"); body.withAssignedId(4091); body.withDeveloperId(4091); body.withSeverityId(10); body.withParentIssueId(1679822); body.withName("test"); body.withTrackerId(3); body.withStatusId(1); body.withPriorityId(2); body.withIterationId(11302238); body.withDescription(""); body.withBeginTime("2018-1-31"); body.withEndTime("2018-07-05"); body.withCreator(creatorbody); request.withBody(body); try { CreateSystemIssueV4Response response = client.createSystemIssueV4(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 | # 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 = CreateSystemIssueV4Request() request.project_id = "{project_id}" creatorbody = Creator( user_id="a360371833bf4c558f796fd707b44daf" ) request.body = CreateSystemIssueRequestV4( assigned_id=4091, developer_id=4091, severity_id=10, parent_issue_id=1679822, name="test", tracker_id=3, status_id=1, priority_id=2, iteration_id=11302238, description="", begin_time="2018-1-31", end_time="2018-07-05", creator=creatorbody ) response = client.create_system_issue_v4(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 | 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.CreateSystemIssueV4Request{} request.ProjectId = "{project_id}" creatorbody := &model.Creator{ UserId: "a360371833bf4c558f796fd707b44daf", } assignedIdCreateSystemIssueRequestV4:= int32(4091) developerIdCreateSystemIssueRequestV4:= int32(4091) severityIdCreateSystemIssueRequestV4:= int32(10) parentIssueIdCreateSystemIssueRequestV4:= int32(1679822) statusIdCreateSystemIssueRequestV4:= int32(1) iterationIdCreateSystemIssueRequestV4:= int32(11302238) descriptionCreateSystemIssueRequestV4:= "" beginTimeCreateSystemIssueRequestV4:= "2018-1-31" endTimeCreateSystemIssueRequestV4:= "2018-07-05" request.Body = &model.CreateSystemIssueRequestV4{ AssignedId: &assignedIdCreateSystemIssueRequestV4, DeveloperId: &developerIdCreateSystemIssueRequestV4, SeverityId: &severityIdCreateSystemIssueRequestV4, ParentIssueId: &parentIssueIdCreateSystemIssueRequestV4, Name: "test", TrackerId: int32(3), StatusId: &statusIdCreateSystemIssueRequestV4, PriorityId: int32(2), IterationId: &iterationIdCreateSystemIssueRequestV4, Description: &descriptionCreateSystemIssueRequestV4, BeginTime: &beginTimeCreateSystemIssueRequestV4, EndTime: &endTimeCreateSystemIssueRequestV4, Creator: creatorbody, } response, err := client.CreateSystemIssueV4(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot