Querying Issues and Metrics
Function
This API is used to query the number of issues and metrics in each scan in a specified period.
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.
|
Action |
Access Level |
Resource Type (*: required) |
Condition Key |
Alias |
Dependencies |
|---|---|---|---|---|---|
|
codeartscheck:task:getReport |
Read |
task * |
- |
- |
- |
|
- |
codeartscheck:ProjectId |
URI
GET /v1/history/defect-metric-trend
|
Parameter |
Mandatory |
Type |
Description |
|---|---|---|---|
|
task_id |
Yes |
String |
Definition : Task ID, returned by the API for creating a check task. Each code check task, branch task, or incremental task generated through an API has a unique ID. Obtain the ID by calling the API used to . id indicates the task ID. Constraints: N/A Value range: 1 to 32 characters. Default value: N/A |
|
start_date |
Yes |
String |
Definition: Start date (UTC). Format: yyyy-MM-dd. For example, 2025-11-20. Constraints: N/A Value range: N/A Default value: N/A |
|
end_date |
Yes |
String |
Definition: End date (UTC). Format: yyyy-MM-dd. For example, 2025-11-30. Constraints: N/A Value range: N/A Default value: N/A |
|
dimension |
Yes |
String |
Definition: Frequency of scanning in the result. Constraints: N/A Value range: Default value: N/A |
Request Parameters
Response Parameters
Status code: 200
|
Parameter |
Type |
Description |
|---|---|---|
|
status |
String |
Definition: Response status. Value range: |
|
result |
Array of DisplayTrend objects |
Definition: Number of issues scanned and measurement statistics. |
|
Parameter |
Type |
Description |
|---|---|---|
|
taskId |
String |
Definition: Task ID. Value range: 1 to 32 characters. |
|
snapshotId |
Integer |
Definition: Measurement snapshot ID. Range: N/A |
|
totalLoc |
Integer |
Definition: Valid code lines, excluding blank and comment lines. Range: N/A |
|
criticalNum |
Integer |
Definition: Number of critical issues. Range: N/A |
|
majorNum |
Integer |
Definition: Number of major issues. Range: N/A |
|
minorNum |
Integer |
Definition: Number of minor issues. Range: N/A |
|
suggestionNum |
Integer |
Definition: Number of suggestions. Range: N/A |
|
createTime |
String |
Definition: Data import start time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2020-09-25T12:05:00Z. Value range: N/A |
|
endTime |
String |
Definition: Data import end time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ. For example, 2020-09-25T12:05:00Z. Value range: N/A |
|
complexity |
String |
Definition: Average cyclomatic complexity. Range: N/A |
|
duplicationRate |
String |
Definition: Code duplication rate. Range: N/A |
Status code: 400
|
Parameter |
Type |
Description |
|---|---|---|
|
error_code |
String |
Definition: Error code. Value range: N/A |
|
error_msg |
String |
Definition: Error message. 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 message. Value range: N/A |
Example Requests
Query all scan results of task ID 2b31ed520xxxxxxebedb6e57xxxxxxxx under project ID e04b357xxxxx5ed832xxxxxx from Jun 1, 2025 (UTC) to Jun 10, 2025 (UTC).
GET https://{endpoint}/v1/history/defect-metric-trend?task_id=897acf5exxx48a5013cd&start_date=2025-06-01&end_date=2024-06-10
Example Responses
Status code: 200
Response body for querying code issues and metrics.
{
"status" : "success",
"error" : null,
"result" : [ {
"taskId" : "45366a990xxx73be2a7a97f",
"snapshotId" : 1,
"openNum" : 37,
"dismissingNum" : 0,
"dismissedNum" : 0,
"fixedNum" : 0,
"totalLoc" : 636,
"criticalNum" : 0,
"majorNum" : 28,
"minorNum" : 6,
"suggestionNum" : 3,
"informationNum" : 0,
"createTime" : "2025-05-22T06:48:32Z",
"endTime" : "2025-05-22T06:48:33Z",
"delayNum" : 0,
"density" : 58.1761,
"complexity" : null,
"duplicationRate" : 0
} ]
}
Status code: 400
Bad Request
{
"error_code" : "CC.xxxxxxxx.400",
"error_msg" : "Verify request parameter failed. Check whether the request parameters are correct."
}
Status code: 401
Unauthorized
{
"error_code" : "CC.00000003",
"error_msg" : "Authentication information expired."
}
Status Codes
|
Status Code |
Description |
|---|---|
|
200 |
Response body for querying code issues and metrics. |
|
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