Creating a Plan
Function
Create a plan (milestone, release, or sprint) under a project. Sub-sprints can be created.
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 /v1/planservice/projects/{project_id}/plans
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition 32-character UUID of a project, which uniquely identifies a project. Obtain the value of this parameter from the project_id field in the response body of the API for querying the project list. 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 A string of 10 to 32,768 characters Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| title | Yes | String | Definition Plan title. Constraints N/A Range 1 to 256 characters. Default Value N/A |
| category | Yes | String | Definition Plan type. The value is of the enumerated type. Constraints N/A Range Default Value N/A |
| description | No | String | Definition Plan description. Constraints N/A Range 0 to 1,000 characters. Default Value N/A |
| plan_start_date | Yes | String | Definition Planned start time, in the format of yyyy-MM-dd. Example: 2024-01-01. Constraints N/A Range N/A Default Value N/A |
| plan_end_date | Yes | String | Definition Planned completion time, in the format of yyyy-MM-dd. Example: 2024-01-01. Constraints N/A Range N/A Default Value N/A |
| parent_id | No | String | Definition Parent plan ID, which is mandatory when category is set to Iteration. It specifies the release plan to which the sprint belongs. Constraints This parameter is mandatory when category is set to Iteration. Range The value is a numeric string of 18 to 19 characters. Default Value N/A |
| workload | No | String | Definition Estimated workload, which is used to identify the required workforce investment for the plan. The unit is person/day. Constraints N/A Range 0 to 11 characters. Default Value N/A |
| owner | No | String | Definition Owner ID, which identifies the owner of a plan. Constraints N/A Range The value can contain 32 characters. Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition Response status. Range |
| message | String | Definition Prompt information. Range N/A |
| result | PlanResponseResult object | Definition Plan details, including complete information about the release/sprint. |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition ID of a release, sprint, or milestone. Range N/A |
| title | String | Definition Title Range N/A |
| category | String | Definition Type. The value is of the enumerated type. Range |
| description | String | Definition Description. Range N/A |
| state | String | Definition Discard flag. The value is of the enumerated type. Range |
| status | String | Definition Release/Sprint status. The value is of the enumerated type. Range |
| children | Array of PlanResponseResult objects | Definition Sub-project sprint information. |
| created_by | String | Definition Creator ID. Range N/A |
| modified_by | String | Definition ID of the last updater. Range N/A |
| plan_start_date | Long | Definition Plan start time, which is a Unix timestamp (unit: millisecond). Range N/A |
| plan_end_date | Long | Definition Plan completion time, which is a Unix timestamp (unit: millisecond). Range N/A |
| created_date | Long | Definition Creation time, which is a Unix timestamp (unit: millisecond). Range N/A |
| parent_id | String | Definition Parent plan ID. When the plan type is iteration, this parameter specifies the release plan to which the work item belongs. Range The value is a numeric string of 18 to 19 characters. |
| baseline | String | Definition Baseline status. The value is of the enumerated type and indicates whether the plan has been included in baseline management. Range |
| workload | String | Definition Estimated workload, which is used to identify the required workforce or time investment for the plan. The unit is person/day. Range Max. 11 characters. |
| owner | String | Definition Owner ID, which identifies the owner of a plan. Range A string of 32 characters. |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error message. Range N/A |
Example Requests
-
POST https://{endpoint}/v1/planservice/projects/2a0d6799fe0d48b29ab8710be556d461/plans { "title" : "plan_0731_1", "category" : "PI", "plan_end_date" : "2025-01-20", "plan_start_date" : "2025-02-01" } -
POST https://{endpoint}/v1/planservice/projects/2a0d6799fe0d48b29ab8710be556d461/plans { "title" : "iteration_0731_1", "category" : "Iteration", "plan_end_date" : "2025-01-20", "plan_start_date" : "2025-02-01", "parent_id" : "1088833093706829825" }
Example Responses
Status code: 200
{
"status" : "success",
"message" : null,
"result" : {
"id" : "123e4567e89b12d3a456426614174000",
"title" : "Project Milestone 1",
"category" : "PlanMilestone",
"description" : "This is an important milestone of the project.",
"state" : "In use",
"status" : "planned",
"children" : [ {
"id" : "123e4567e89b12d3a456426614174000",
"title" : "Sprint 1",
"category" : "Iteration",
"description" : "Sprint 1 description.",
"state" : "In use",
"status" : "planned",
"children" : [ ],
"created_by" : "user1",
"modified_by" : "user1",
"plan_start_date" : 1633072800000,
"plan_end_date" : 1635751200000,
"created_date" : 1633072800000,
"parent_id" : "123e4567e89b12d3a456426614174000",
"baseline" : "unbaseline",
"workload" : "10 person-days",
"owner" : "user2"
} ],
"created_by" : "admin",
"modified_by" : "admin",
"plan_start_date" : 1630466400000,
"plan_end_date" : 1633072800000,
"created_date" : 1630466400000,
"parent_id" : null,
"baseline" : "unbaseline",
"workload" : "20 person-days",
"owner" : "user1"
}
} Status code: 400
{
"error_msg" : "Invalid project_id or other parameters",
"error_code" : "AS.0001"
} 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
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 CreatePlansSolution { 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(); CreatePlansRequest request = new CreatePlansRequest(); request.withProjectId("{project_id}"); PlanCreateParam body = new PlanCreateParam(); body.withPlanEndDate("2025-01-20"); body.withPlanStartDate("2025-02-01"); body.withCategory("PI"); body.withTitle("plan_0731_1"); request.withBody(body); try { CreatePlansResponse response = client.createPlans(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()); } } }
-
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
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 CreatePlansSolution { 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(); CreatePlansRequest request = new CreatePlansRequest(); request.withProjectId("{project_id}"); PlanCreateParam body = new PlanCreateParam(); body.withParentId("1088833093706829825"); body.withPlanEndDate("2025-01-20"); body.withPlanStartDate("2025-02-01"); body.withCategory("Iteration"); body.withTitle("iteration_0731_1"); request.withBody(body); try { CreatePlansResponse response = client.createPlans(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
# 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 = CreatePlansRequest() request.project_id = "{project_id}" request.body = PlanCreateParam( plan_end_date="2025-01-20", plan_start_date="2025-02-01", category="PI", title="plan_0731_1" ) response = client.create_plans(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg)
-
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
# 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 = CreatePlansRequest() request.project_id = "{project_id}" request.body = PlanCreateParam( parent_id="1088833093706829825", plan_end_date="2025-01-20", plan_start_date="2025-02-01", category="Iteration", title="iteration_0731_1" ) response = client.create_plans(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
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.CreatePlansRequest{} request.ProjectId = "{project_id}" request.Body = &model.PlanCreateParam{ PlanEndDate: "2025-01-20", PlanStartDate: "2025-02-01", Category: "PI", Title: "plan_0731_1", } response, err := client.CreatePlans(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } }
-
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
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.CreatePlansRequest{} request.ProjectId = "{project_id}" parentIdPlanCreateParam:= "1088833093706829825" request.Body = &model.PlanCreateParam{ ParentId: &parentIdPlanCreateParam, PlanEndDate: "2025-01-20", PlanStartDate: "2025-02-01", Category: "Iteration", Title: "iteration_0731_1", } response, err := client.CreatePlans(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 | Plan created successfully. |
| 400 | The error message is returned. |
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