Skip to main content

Configure a Dynamic Analysis for internal scanning with the REST API

You can use the Dynamic Analysis API to configure an analysis to run with Veracode Internal Scanning Management (ISM).

Before you begin:

To authenticate with Veracode, ensure you have set up API authentication for HMAC or OAuth 2.0.

To complete this task:

  1. Sign in to the Veracode Platform.

  2. Go to https://ui.analysiscenter.veracode.com/mvsa/admin/gateways?depth=1.

  3. Obtain these values:

    • Gateway ID by looking for the ref_id corresponding to the gateway name
    • Endpoint ID by looking for the token corresponding to the gateway name
  4. Add the gateway ID and endpoint ID to the JSON file.

  5. Send the following request:

    Veracode HMAC authentication

    Get-Content input.json | http --auth-type=veracode_hmac POST "https://api.veracode.com/was/configservice/v1/analyses"

    OAuth 2.0 Client Credentials authentication

    Get-Content input.json | http --auth-type=oauth2-client-credentials-flow `
    --auth="$($env:VERACODE_CLIENT_ID):$($env:VERACODE_CLIENT_SECRET)" `
    --token-endpoint="$($env:VERACODE_TOKEN_URL)" `
    --token-request-type=basic POST "https://api.veracode.com/was/configservice/v1/analyses"

Example payload​

This is an example of a Dynamic Analysis configured for ISM:

{
"name": "Name-of-Your-Dynamic-Analysis",
"scans": [
{
"scan_config_request": {
"target_url": {
"url": "http://www.example.com/",
"http_and_https": true,
"directory_restriction_type": "DIRECTORY_AND_SUBDIRECTORY"
}
},
"internal_scan_configuration": {
"enabled": true,
"gateway_id": "12345678-85b2-4fe2-a633-425418f6a5ef",
"endpoint_id": "1234abcd-cecc-43e8-a658-6b3447c3e52a"
}
}
],
"schedule": {
"now": true,
"duration": {
"length": 1,
"unit": "DAY"
}
}
}