Update a Dynamic Analysis of an API with the REST API
You can use the Dynamic Analysis API to update an analysis of a REST API. In your request, you specify the ID of the target analysis.
To complete this task:
-
Edit the values in your JSON payload.
-
To get a list of analyses by name, send the following request:
http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/analyses/"
-
To get the
analysis_id
for an analysis, send the following request, wherename
is the name of the target analysis:http --auth-type=veracode_hmac GET "https://api.veracode.com/was/configservice/v1/analyses?name={name}"
-
To apply the changes in your JSON payload to the analysis, send the following request:
http --auth-type=veracode_hmac PUT "https://api.veracode.com/was/configservice/v1/analyses/{analysis_id}?method=PATCH" < input.json
The following example payload specifies to:
- Add a new scan for the API specification specified for the
spec_id
property. For more information, see Get API Specification Details. - Delete the scan specified for the
scan_id
property. - Start scanning on the date and time specified for the
schedule
property, and run for two days.
{
"scans": [
{
"action_type": "ADD",
"request_id": "0",
"scan_config_request": {
"api_scan_setting": {
"spec_id": "{ID_of_your_API_specification}"
},
"target_url": {
"url": "https://www.example.com"
}
}
},
{
"action_type": "REMOVE",
"scan_id": "{ID_of_scan}"
}
],
"schedule": {
"duration": {
"length": 2,
"unit": "DAY"
},
"now": false,
"schedule_status": "ACTIVE",
"start_date": "2023-04-21T12:12:11-04:00"
}
} - Add a new scan for the API specification specified for the