Create a Dynamic Analysis of a single URL with the REST API
You can use the Dynamic Analysis API to create an analysis of a single URL.
Before you begin:
To authenticate with Veracode, ensure you have set up API authentication for HMAC or OAuth 2.0.
To complete this task:
-
Enter values for the
scan_config_requestandscheduleproperties in the JSON file. -
Send the following request:
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
This is an example of a Dynamic Analysis for one URL that runs immediately for one day:
{
"name": "Name-of-Your-Dynamic-Analysis",
"scans": [
{
"scan_config_request": {
"target_url": {
"url": "http://www.example.com"
}
}
}
],
"schedule": {
"duration": {
"length": 1,
"unit": "DAY"
},
"scheduled": true,
"now": true
}
}