Get SAST Scan Details by Scan Id - GET /sast/scans/{id} (v8.8.0 and up)

Get details of a specific SAST scan. Scan details can only be retrieved once a scan has been performed and the scan Id (id) is known. To create a new scan use POST /sast/scan.

Usage:

  1. POST /sast/scan and create a new scan
  2. GET /sast/scans/{id} and get details of a specific scan

URL

http://localhost/cxrestapi/sast/scans/{id}

Method:

GET

Media Type (header):

Authorization: Bearer <access token value>
Accept: application/json;v=1.0

Parameters

Required:

id=[integer] – Unique Id of the scan

Curl Sample:

curl -X GET --header 'Accept: application/json' --header 'Authorization: Bearer <access token> 'http://localhost/cxrestapi/sast/scans/1000062'

Sample Response:

{
  "id": 1000057,
  "project": {
    "id": 41,
    "name": "Project 1 (8.8)",
    "link": {
      "rel": "project",
      "uri": "/projects/41"
    }
  },
  "status": {
    "id": 7,
    "name": "Finished",
    "details": {
      "stage": "",
      "step": ""
    }
  },
  "scanType": {
    "id": 1,
    "value": "Regular"
  },
  "comment": "",
  "dateAndTime": {
    "startedOn": "2018-05-27T17:50:24.83",
    "finishedOn": "2018-05-27T17:52:28.71",
    "engineStartedOn": "2018-05-27T17:50:24.83",
    "engineFinishedOn": "2018-05-27T17:52:28.427"
  },
  "resultsStatistics": {
    "link": {
      "rel": "results-statistics",
      "uri": "/sast/scans/1000057/resultsStatistics"
    }
  },
  "scanState": {
    "path": " N/A (Zip File)",
    "sourceId": "0000000034_000315599833_001616083091",
    "filesCount": 34,
    "linesOfCode": 6864,
    "failedLinesOfCode": 6,
    "cxVersion": "8.8.0.838",
    "languageStateCollection": [
      {
        "languageID": 1073741824,
        "languageName": "Common",
        "languageHash": "1060095108086482",
        "stateCreationDate": "2018-05-10T10:39:11.26"
      },
      {
        "languageID": 1,
        "languageName": "CSharp",
        "languageHash": "2082253736012464",
        "stateCreationDate": "2018-05-21T14:27:30.48"
      },
      {
        "languageID": 8,
        "languageName": "JavaScript",
        "languageHash": "0551811326035748",
        "stateCreationDate": "2018-05-10T10:39:11.26"
      },
      {
        "languageID": 64,
        "languageName": "VbScript",
        "languageHash": "1349101913133594",
        "stateCreationDate": "2018-05-10T10:39:11.26"
      }
    ]
  },
  "owner": "admin@cx",
  "origin": "Web Portal",
  "initiatorName": "admin admin",
  "owningTeamId": "00000000-1111-1111-b111-989c9070eb11",
  "isPublic": true,
  "isLocked": false,
  "isIncremental": false,
  "scanRisk": 85,
  "scanRiskSeverity": 55,
  "engineServer": {
    "id": 4,
    "name": "100plus",
    "link": {
      "rel": "engine-server",
      "uri": "/sast/engineServers/4"
    }
  },
  "finishedScanStatus": {
    "id": 1,
    "value": "Completed"
  },
  "partialScanReasons": []
}

Success Response:

Code: 200 OK

Error Response:

Code: 400 Bad Request

Notes:

Retrieves details of a specific SAST scan. Must be a valid SAST scan in order to retrieve scan details. Status of the scan can be: 1="New", 2="PreScan", 3="Queued", 4="Scanning", 6="PostScan", 7="Finished", 8="Canceled", 9="Failed", 10="SourcePullingAndDeployment", 1001="None". If the request fails, it returns an error response. Must be a valid SAST scan in order to retrieve scan details.