Querying the On-Time Requirement Completion Rate
Function
This API is used to query on–time requirement completion rate.
Calling Method
For details, see Calling APIs.
URI
POST /v1/{project_id}/completion-rate/query
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 Querying the Project List API. Constraints: Regular expression: [A-Za-z0-9]{32} Options: N/A Default value: N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition: User token. Obtain the token by calling theObtaining a User TokenIAM API. In the returned response header, X-Subject-Token is the desired user token. Constraints: Mandatory. Range: Minimum length: 10 character. Maximum length: 32,768 characters. Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
date_range |
No |
String |
Definition: Statistical period. Constraints: Regular expression: ([0-9]{1,15},[0-9]{1,15}) Options: N/A Default value: N/A |
metric_type |
No |
String |
Definition: Metric type. Constraints: Regular expression: (bug_density|issues_per_developer|on-time_completion_rate) Options: bug_density, issues_per_developer, and on-time_completion_rate. Default value: N/A |
sprint_id |
No |
String |
Definition: Sprint ID, which can be obtained using the Obtaining the Sprint List of a Specified Project API. Constraints: Regular expression: (([A-Za-z0-9,-]{0,32768})) Options: N/A Default value: N/A |
dividend |
No |
dividend object |
Definition: Numerator filter criteria. Constraints: N/A |
divisor |
No |
divisor object |
Indicator Denominator Filter Criteria |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
custom_field16 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field17 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field18 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field19 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field20 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field21 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field22 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field23 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field24 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field25 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field26 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field27 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field28 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field29 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field30 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field31 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field32 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field33 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field34 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field35 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field36 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field37 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field38 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field39 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field40 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
on_time |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
custom_field16 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field17 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field18 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field19 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field20 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field21 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field22 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field23 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field24 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field25 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field26 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field27 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field28 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field29 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field30 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field31 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field32 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field33 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field34 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field35 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field36 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field37 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field38 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field39 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
custom_field40 |
No |
String |
Definition: Custom field. Constraints: N/A Options: N/A Default value: N/A |
on_time |
No |
String |
Definition: On time or not. Constraints: Regular expression: (ontime|all) Options: ontime: on time all: all Default value: N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
dividend_value |
String |
Definition: Numerator. Options: N/A |
divisor_value |
String |
Definition: Denominator. Options: N/A |
metric_name |
String |
Definition: Metric name. Options: N/A |
metric_value |
String |
Definition: Metric value. Options: N/A |
project_id |
String |
Definition: Project ID. Options: N/A |
project_name |
String |
Definition: Project name. Options: N/A |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error Codes |
error_msg |
String |
Description |
Status code: 401
Parameter |
Type |
Description |
---|---|---|
error_code |
String |
Error Codes |
error_msg |
String |
Description |
Example Requests
Post https://{endpoint}/v1/eace9c0a00574de6878ab580daa9a317/completion-rate/query { "date_range" : "1598457600000,1598544000000", "dividend" : { "custom_field16" : "Custom field value", "on_time" : "ontime" }, "divisor" : { "custom_field16" : "Custom field value", "on_time" : "ontime" }, "metric_type" : "on-time_completion_rate", "sprint_id" : "8883443" }
Example Responses
Status code: 200
OK
{ "dividend_value" : 15, "divisor_value" : 20, "metric_name" : "completion_rate|bug_density|bugs_per_developer", "metric_value" : 0.8945, "project_id" : "eace9c0a00574de6878ab580daa9a317", "project_name" : "My Project" }
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 |
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 ShowCompletionRateSolution { 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(); ShowCompletionRateRequest request = new ShowCompletionRateRequest(); request.withProjectId("{project_id}"); MetricRequest3 body = new MetricRequest3(); MetricRequest3Dividend dividendbody = new MetricRequest3Dividend(); dividendbody.withOnTime("ontime") .withCustomField16("Custom field value"); body.withDivisor("{\"on_time\":\"ontime\",\"custom_field16\":\"Custom field value\"}"); body.withDividend(dividendbody); body.withSprintId("8883443"); body.withMetricType("on-time_completion_rate"); body.withDateRange("1598457600000,1598544000000"); request.withBody(body); try { ShowCompletionRateResponse response = client.showCompletionRate(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 |
# 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 = ShowCompletionRateRequest() request.project_id = "{project_id}" dividendbody = MetricRequest3Dividend( on_time="ontime", custom_field16="Custom field value" ) request.body = MetricRequest3( divisor="{\"on_time\":\"ontime\",\"custom_field16\":\"Custom field value\"}", dividend=dividendbody, sprint_id="8883443", metric_type="on-time_completion_rate", date_range="1598457600000,1598544000000" ) response = client.show_completion_rate(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 |
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.ShowCompletionRateRequest{} request.ProjectId = "{project_id}" onTimeDividend:= "ontime" customField16Dividend:= "Custom field value" dividendbody := &model.MetricRequest3Dividend{ OnTime: &onTimeDividend, CustomField16: &customField16Dividend, } var divisorMetricRequest3 interface{} = "{\"on_time\":\"ontime\",\"custom_field16\":\"Custom field value\"}" sprintIdMetricRequest3:= "8883443" metricTypeMetricRequest3:= "on-time_completion_rate" dateRangeMetricRequest3:= "1598457600000,1598544000000" request.Body = &model.MetricRequest3{ Divisor: &divisorMetricRequest3, Dividend: dividendbody, SprintId: &sprintIdMetricRequest3, MetricType: &metricTypeMetricRequest3, DateRange: &dateRangeMetricRequest3, } response, err := client.ShowCompletionRate(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.
Feedback
Was this page helpful?
Provide feedbackThank 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