Skip to main content

Add a URL scan to a Dynamic Analysis with the REST API

You can use the Dynamic Analysis API to add a URL to an existing analysis.

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. Add the URL to the scan_config_request property in the JSON file.

  2. Ensure the action_type property is set to ADD in the JSON file.

  3. Send the following request to get a list of analyses by name:

    Veracode HMAC authentication

    http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/analyses/"

    OAuth 2.0 Client Credentials authentication

    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 GET "https://api.veracode.com/was/configservice/v1/analyses/"
  4. Send the following request, where name is the name of the analysis you want to edit:

    Veracode HMAC authentication

    http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/analyses?name={name}"

    OAuth 2.0 Client Credentials authentication

    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 GET "https://api.veracode.com/was/configservice/v1/analyses?name={name}"
  5. Obtain the analysis_id of the analysis you want to edit.

  6. Send the following request to add the URL:

    Veracode HMAC authentication

    Get-Content input.json | http --auth-type=veracode_hmac PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH"

    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 PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH"

Example payload​

The API passes the JSON file that you populate with the necessary values as shown in this example payload:

{
"name": "Name-of-Your-Dynamic-Analysis",
"scans": [
{
"scan_config_request": {
"target_url": {
"url": "https://www.example.com"
}
},
"action_type": "ADD"
}
]
}