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

Querying Issue Summary

Function

This API is used to query the issue summary based on the check task ID, including the issue overview, issue status, cyclomatic complexity, and duplication rate.

Calling Method

For details, see Calling APIs.

URI

GET /v2/tasks/{task_id}/defects-summary

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

task_id

Yes

String

Definition

Task ID, returned by the API for creating a check task. Each CodeArts Check task, branch task, or incremental task generated through an API has a unique ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

job_id

No

String

Definition

Execution record ID, that is, the unique ID of each version or quality gate scan. The ID is used to query quality gate tasks.

Constraints

N/A

Range

N/A

Default Value

N/A

merge_id

No

String

Definition

Merge request ID or commit ID. They are used to query quality gate tasks.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

User token. Obtain a token by calling the IAM API forobtaining a user token. The value of X-Subject-Token in the response header is the user token.

Constraints

N/A

Range

1–100,000 characters

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

taskId

String

Definition

Task ID, returned by the API for creating a check task. Each CodeArts Check task, branch task, or incremental task generated through an API has a unique ID.

Range

N/A

task_name

String

Definition

Task name.

Range

N/A

creator_id

String

Definition

User ID of the task creator.

Range

N/A

git_url

String

Definition

Code repository address.

Range

N/A

git_branch

String

Definition

Code repository branch. Specify a source branch in MR mode.

Range

N/A

last_check_time

String

Definition

Last check time.

Range

N/A

code_line_total

Integer

Definition

Original code lines, including blank and comment lines.

Range

N/A

code_line

Integer

Definition

Valid code lines, excluding blank and comment lines.

Range

N/A

code_quality

Number

Definition

Code quality.

Range

N/A

issue_count

Integer

Definition

Total number of issues.

Range

N/A

risk_coefficient

Number

Definition

Risk score.

Range

N/A

duplication_ratio

String

Definition

Duplication rate.

Range

N/A

complexity_count

Integer

Definition

Total cyclomatic complexity.

Range

N/A

duplicated_lines

Integer

Definition

Total number of duplicate lines.

Range

N/A

comment_lines

Integer

Definition

Number of comment lines.

Range

N/A

comment_ratio

String

Definition

Comment line percentage.

Range

N/A

duplicated_blocks

Integer

Definition

Number of duplicate blocks.

Range

N/A

last_exec_time

String

Definition

Last execution duration.

Range

N/A

check_type

String

Definition

Check type.

Range

N/A

created_at

String

Definition

Creation time.

Range

N/A

cyclomatic_complexity_per_method

String

Definition

Average cyclomatic complexity per method.

Range

N/A

cyclomatic_complexity_per_file

String

Definition

Average cyclomatic complexity per file.

Range

N/A

critical_count

String

Definition

Number of critical issues.

Range

N/A

major_count

String

Definition

Number of major issues.

Range

N/A

minor_count

String

Definition

Number of minor issues.

Range

N/A

suggestion_count

String

Definition

Number of suggestions.

Range

N/A

is_access

String

Definition

Whether the quality gate is passed.

Range

N/A

review_result

String

Definition

Whether the quality gate is passed.

Range

N/A

trigger_type

String

Definition

Task triggering mode.

Range

N/A

file_duplication_ratio

String

Definition

File duplication rate.

Range

N/A

new_count

Integer

Definition

Number of pending issues.

Range

N/A

solve_count

Integer

Definition

Number of resolved issues.

Range

N/A

dismissed_count

Integer

Definition

Number of ignored issues.

Range

N/A

duplicated_files

Integer

Definition

Number of duplicate files.

Range

N/A

new_critical_count

String

Definition

Number of new critical issues.

Range

N/A

new_major_count

String

Definition

Number of new major issues.

Range

N/A

new_minor_count

String

Definition

Number of new minor issues.

Range

N/A

new_suggestion_count

String

Definition

Number of new suggestions.

Range

N/A

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

Query the issue summary of task ID 2b31ed520xxxxxxebedb6e57xxxxxxxx.

GET https://{endpoint}/v2/tasks/2b31ed520xxxxxxebedb6e57xxxxxxxx/defects-summary

null

Example Responses

Status code: 200

Request succeeded!

{
  "task_id" : "435b58ecf7f54c45907c1384d01c94a6",
  "task_name" : "CSharp_02201119",
  "creator_id" : "ecadebb5041146cc96f9780f3d905e20",
  "git_url" : "git@****_02201119.git",
  "git_branch" : "master",
  "last_check_time" : "2020-02-20 11:37:46",
  "code_line_total" : 20,
  "code_line" : 156,
  "code_quality" : 147.4,
  "issue_count" : 3,
  "risk_coefficient" : 23,
  "duplication_ratio" : "0.0%",
  "complexity_count" : 0,
  "duplicated_lines" : 0,
  "comment_lines" : 0,
  "comment_ratio" : "0",
  "duplicated_blocks" : 0,
  "last_exec_time" : "2 minutes and 28 seconds",
  "check_type" : "source",
  "created_at" : "2020-02-20 11:21:11",
  "cyclomatic_complexity_per_method" : "84.0",
  "cyclomatic_complexity_per_file" : "112.0",
  "critical_count" : 2,
  "major_count" : 1,
  "minor_count" : 1,
  "suggestion_count" : 1,
  "is_access" : 0,
  "trigger_type" : 1,
  "file_duplication_ratio" : "33.3%",
  "new_count" : 0,
  "solve_count" : 0,
  "duplicated_files" : 0,
  "new_critical_count" : "0",
  "new_major_count" : "0",
  "new_minor_count" : "0",
  "new_suggestion_count" : "0"
}

Status code: 400

Bad Request

{
  "error_code" : "CC.00000000",
  "error_msg" : "Network busy. Try again later."
}

Status code: 401

Unauthorized

{
  "error_code" : "CC.00000003",
  "error_msg" : "Authentication information expired."
}

Status Codes

Status Code

Description

200

Request succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.