Running a Scan

The API client can call an immediate scan. Depending on whether the submitted project name (CliScanArgs.PrjSettings.ProjectName) already exists, the scan is called for the existing CxSAST project or a new project is created.

CxSDKWebService.Scan Method


Parameters

When scanning to an existing CxSAST project, get the existing project configuration, modify as needed, and submit the modified project configuration object.

Return Value

CxWSResponseRunID, including:

Example 1

To scan from a local source to an new project:

Example 2

To call an immediate scan to an existing project with a known ID of 200, maintaining existing project settings:

SOAP to REST Mapping

This section covers SOAP to REST migration and mapping of our legacy SOAP based SDK to the new REST APIs. It is recommended to use this reference only once CxSAST V8.8.0 is installed.

Scan

POST /sast/scanSettings

Define a specific project’s scan settings. Parameters include - presetId, engineConfigurationId, postScanActionId and emailNotifications (beforescan, failedScans, afterScans).


POST /projects/{Id}/sourceCode/attachmentsUpload a specific project’s zip file (contains the source code for scanning). Parameters include - zippedSource.

POST /projects/{Id}/sourceCode/remoteSettings/git

Set a specific project’s remote source settings for GIT. Parameters include - url, branch and privateKey.


GET /projects/{Id}/sourceCode/remoteSettings/git

Get a specific project’s remote source settings for GIT.


POST /projects/{Id}/sourceCode/remoteSettings/git/ssh

Set a specific project’s remote source settings for GIT using SSH. Parameters include - url, branch and privateKey.

POST /projects/{Id}/sourceCode/remoteSettings/svnSet a specific project’s remote source settings for SVN. Parameters include - url, absoluteUrl, port, paths and credentials (username, password and privateKey).

GET /projects/{Id}/sourceCode/remoteSettings/svn

Get a specific project’s remote source settings for SVN.


POST /projects/{Id}/sourceCode/remoteSettings/svn/sshSet a specific project’s remote source settings for SVN using SSH. Parameters include - absoluteUrl, port, paths and privateKey.

POST /projects/{Id}/sourceCode/remoteSettings/tfsSet a specific project’s remote source settings for TFS. Parameters include - credentials (username and password), url, absoluteUrl, port and paths.

GET /projects/{Id}/sourceCode/remoteSettings/tfs

Get a specific project’s remote source settings for TFS.


POST /projects/{Id}/sourceCode/remoteSettings/perforce

Set a specific project’s remote source settings for Perforce. Parameters include - credentials (username and password), url, absoluteUrl, port, paths and browseMode.


GET /projects/{Id}/sourceCode/remoteSettings/perforce

Get a specific project’s remote source settings for Perforce. 


POST /projects/{Id}/sourceCode/remoteSettings/sharedSet a specific project’s remote source settings for a shared repository. Parameters include – paths and credentials (username and password).

GET /projects/{Id}/sourceCode/remoteSettings/shared

Get a specific project’s remote source settings for a shared repository. 


POST /projects/{Id}/sourceCode/remoteSettings/customSet a specific project’s remote source settings for a custom repository (e.g. source pulling). Parameters include – paths and credentials (username and password).

GET /projects/{Id}/sourceCode/remoteSettings/customGet a specific project’s remote source settings for a custom repository (e.g. source pulling). Parameters include – paths, preScanCommandId and credentials (username and password).

POST /sast/scansCreate a new scan and assign it to a specific project. Parameters include – isIncremental, isPublic, forceScan and comment.

For more mapping information, refer to API Mapping (SOAP to REST). You can also find a summary of our REST APIs here.