Help Center/ CodeArts Check/ API Reference/ Application Examples/ Example 2: Querying the Defect Summary
Updated on 2024-03-15 GMT+08:00

Example 2: Querying the Defect Summary

Scenario

Query the defect summary based on the check task ID, including the issue overview, issue status, cyclomatic complexity, and code repetition rate.

Constraints

The task exists.

Involved API

The following API is involved:

Querying the Defect Summary: queries the defect summary, including the issue overview, issue status, cyclomatic complexity, and code repetition rate.

Procedure

  • API information

    URI format: GET /v2/tasks/{task_id}/defects-summary

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

    Obtain the information from Endpoints.

  • Example response
    {
    "result":{
    "info":{
    "projectId":"b9db371361724226937f3280df1d4fc4",
    "devCloudProjectId":"a2b9a42ee6494e0794f5655f8535920e",
    "devCloudProjectName":"TestDemo",
    "codeHubName":"portal-ts",
    "codeHubWebUrl":"https://xxxxx/portal-ts",
    "codeLineTotal":"63371",
    "projectName":"portal-ts-abctest111222",
    "creatorId":"ae161856f2604229ae12056478a7919f",
    "creatorName":"devcloud_devcloud_y00336947_01",
    "domainId":"78d0e09c1ad0425b9b4f3a8fdd066164",
    "domainName":"devcloud_devcloud_y00336947_01",
    "gitUrl":"git@xxxxx/portal-ts.git",
    "branch":"master",
    "language":"[
    \"html\"
    ]",
    "filePath":"[
    \"\"
    ]",
    "lastCheckTime\"":"2019-09-24 15:00:41",
    "codeQuality":"141.7",
    "codeLine":"55777",
    "projectStatus":"2",
    "riskCoefficient":"790",
    "starLevel":"0",
    "defectInfo":{
    "totalCount":"0",
    "criticalCount":"0",
    "seriousCount":"0",
    "normalCount":"0",
    "promptCount":"0"
    },
    "defectStatusInfo":{
    "totalCount":"2952",
    "newCount":"2952",
    "ignoredCount":"0",
    "fixedCount":"0"
    },
    "progress":{
    
    },
    "createdAt":"2019-08-08 17:56:40",
    "duplications":"24.0%",
    "complexityNum":"0",
    "complexityAvg":"0",
    "duplicatedLines":"15206",
    "commentLines":"0",
    "commentRatio":"0",
    "duplicatedBlocks":"0",
    "lastExecTime":"2 minutes 4 seconds",
    "checkType":"source",
    "dependenceType":"",
    "logDatasStr":{
    
    }
    }
    },
    "status":"success"
    }