Link Dynamic Analysis results to an application profile with the REST API
You can use the Dynamic Analysis API to link analysis scan results to an application profile.
Linking results allows you to aggregate all scan types of the target URL into a single report and also evaluate the results against policy.
Before you begin:
To authenticate with Veracode, ensure you have set up API authentication for HMAC or OAuth 2.0.
To complete this task:
-
Send the following request to get a list of application profiles by name:
Veracode HMAC authentication
http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/platform_applications"OAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
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/platform_applications"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic GET "https://api.veracode.com/was/configservice/v1/platform_applications"You can also get application details by making a GET call to the Applications API.
-
Locate the application UUID and add the UUID to the
linked_platform_app_uuidproperty in your JSON file. -
Send the following request to create an analysis that links the results to the specified UUID for your application:
Veracode HMAC authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
Get-Content input.json | http --auth-type=veracode_hmac POST "https://api.veracode.com/was/configservice/v1/analyses"http --auth-type=veracode_hmac POST "https://api.veracode.com/was/configservice/v1/analyses" < input.jsonOAuth 2.0 Client Credentials authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
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"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic POST "https://api.veracode.com/was/configservice/v1/analyses" < input.json
Example payload
The API passes the JSON file that you populate with the necessary values as shown in this example payload.
In this example, linked_platform_app_uuid specifies the UUID of the application profile to link to the scan results. target_url specifies the URL configuration for the target web application you want to scan.
{
"name": "Name-of-Your-Dynamic-Analysis",
"scans": [
{
"linked_platform_app_uuid": "abcd1234-e6d0-475d-ac70-abff5388fa75",
"scan_config_request": {
"target_url": {
"url": "http://www.example.com/",
"http_and_https": true,
"directory_restriction_type": "DIRECTORY_AND_SUBDIRECTORY"
}
}
}
],
"schedule": {
"now": true,
"duration": {
"length": 1,
"unit": "DAY"
}
}
}