Remove a URL scan from a Dynamic Analysis with the REST API
You can use the Dynamic Analysis API to delete a URL scan from an 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:
-
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
- 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/analyses/"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/analyses/" -
Send the following request, where
nameis 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
- 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/analyses?name={name}"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/analyses?name={name}" -
Obtain the
analysis_idof the analysis you want to edit. -
Send the following request to find the
scan_id:Veracode HMAC authentication
http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}/scans"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/analyses/{analysis_id}/scans"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/analyses/{analysis_id}/scans" -
Add the scan ID to the JSON file.
-
Ensure the
action_typeproperty is set toREMOVEin the JSON file. -
Send the following request, where
analysis_idis the ID of the analysis from which to delete the scan:Veracode HMAC authentication
- Windows (PowerShell)
- macOS, Linux, or UNIX
Get-Content input.json | http --auth-type=veracode_hmac PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH"http --auth-type=veracode_hmac PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH" < 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 PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH"http --auth-type=oauth2-client-credentials-flow \--auth="$VERACODE_CLIENT_ID:$VERACODE_CLIENT_SECRET" \--token-endpoint="$VERACODE_TOKEN_URL" \--token-request-type=basic PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH" < input.json
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": [
{
"action_type": "REMOVE",
"scan_id": "{scan_id}"
}
]
}