Updated on 2025-08-25 GMT+08:00

Querying Per Capita Bugs

Function

This API is used to query average bugs per user.

Calling Method

For details, see Calling APIs.

URI

POST /v1/{project_id}/bugs-per-developer/query

Table 1 Path Parameters

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

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

dividend

No

dividend object

Definition:

Metric numerator (default: number of bugs of specified developers in the project).

Options:

N/A

divisor

No

divisor object

Definition:

Metric denominator (default: number of developers in the project).

Options:

N/A

metric_type

No

String

Definition:

Metric type. The options are as follows:

completion_rate (completion rate)

bug_density (bug percentage per thousand lines of code)

bugs_per_developer (number of bugs per developer)

Constraints:

N/A

Options:

completion_rate, bug_density, and bugs_per_developer

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:

N/A

Options:

N/A

Default value:

N/A

Table 3 dividend

Parameter

Mandatory

Type

Description

custom_field16

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field17

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field18

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field19

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field20

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field21

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field22

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field23

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field24

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field25

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field26

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field27

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field28

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field29

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field30

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field31

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field32

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field33

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field34

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field35

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field36

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field37

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field38

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field39

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field40

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

Table 4 divisor

Parameter

Mandatory

Type

Description

custom_field16

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field17

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field18

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field19

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field20

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field21

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field22

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field23

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field24

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field25

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field26

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field27

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field28

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field29

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field30

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field31

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field32

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field33

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field34

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field35

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field36

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field37

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field38

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field39

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

custom_field40

No

String

Definition:

Custom field.

Constraints:

Based on the custom values.

Options:

Based on the custom values.

Default value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

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

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error Codes

error_msg

String

Description

Example Requests

Post https://{endpoint}/v1/eace9c0a00574de6878ab580daa9a317/bugs-per-developer/query

{ }

Example Responses

Status code: 200

OK

{
  "project_id" : "89ad9e4f9cec4725bff5b8d62c1f98d6",
  "project_name" : "ScrumReport verification",
  "metric_value" : "2.0",
  "metric_name" : "bugs_per_developer",
  "dividend_value" : "2",
  "divisor_value" : "1"
}

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
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 ShowBugsPerDeveloperSolution {

    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();
        ShowBugsPerDeveloperRequest request = new ShowBugsPerDeveloperRequest();
        request.withProjectId("{project_id}");
        MetricRequest2 body = new MetricRequest2();
        request.withBody(body);
        try {
            ShowBugsPerDeveloperResponse response = client.showBugsPerDeveloper(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
# 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 = ShowBugsPerDeveloperRequest()
        request.project_id = "{project_id}"
        request.body = MetricRequest2(
        )
        response = client.show_bugs_per_developer(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
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.ShowBugsPerDeveloperRequest{}
	request.ProjectId = "{project_id}"
	request.Body = &model.MetricRequest2{
	}
	response, err := client.ShowBugsPerDeveloper(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.