Create a Dynamic Analysis of Multiple URLs with User Agent and Blocklist

Veracode APIs

Use this code to create a Dynamic Analysis to scan multiple URLs, specify a user agent, and identify blocklisted URLs.

To create a Dynamic Analysis of multiple URLs with user agent and blocklist configurations, make a POST call to https://api.veracode.com/was/configservice/v1/analyses, specifying the user agent details and any URLs you do not want Veracode to scan.

If you want to specify a custom header, the type field must be CUSTOM. If you use a predefined agent, such as IE11, you cannot include a custom_header field.

The following is an example of a Dynamic Analysis of multiple URLs. This analysis specifies the agent user string and the URLs to exclude from both the analysis and the URL scan.
Note: The URLs that you blocklist at the URL-specific level take precedence over the URLs in this blocklist. For example, if you blocklist a URL in your URL configuration, but not in the configuration of the whole Dynamic Analysis, the URL configuration blocklist determines which URLs to exclude from the scan.
{
  "name": "Veracode API ",
  "scans": [
    {
      "scan_config_request": {
        "target_url": {
          "url": "http://www.example.com/one/"
        },
        "scan_setting": {
          "user_agent": {
            "type": "CUSTOM",
            "custom_header": "Custom User Agent String"
          },
          "blacklist_configuration": {
            "blackList": [
              {
                "url": "http://www.example.com/one/black/",
                "http_and_https": true
              }
            ]
          }
        }
      }
    },
    {
      "scan_config_request": {
        "target_url": {
          "url": "http://www.example.com/two/",
          "http_and_https": true
        }
      }
    }
  ],
  "org_info": {
    "email": "user@example.com"
  },
  "visibility": {
    "setup_type": "SEC_LEADS_ONLY",
    "team_identifiers": []
  },
  "scan_setting": {
    "blacklist_configuration": {
      "blackList": [
        {
          "url": "http://www.example.com/black1/",
          "http_and_https": false
        },
        {
          "url": "http://www.example.com/black2/site.html",
          "http_and_https": false
        }
      ]
    },
    "user_agent": {
      "type": "CUSTOM",
      "custom_header": "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko VERACODE"
    }
  }
}