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_idfor an analysis, send the following request, wherenameis 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:
- "action_type": "ADD": add a new scan using the API specification and custom base URL specified for- api_scan_setting. The custom base URL defines the target API server and is required for Postman Collections. To obtain the ID for a specification, see Get API specification details.
- "action_type": "REMOVE": delete the scan with the ID specified for- scan_id.
- "schedule": start scanning on the specified date and time, 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}",
           "custom_base_url": "https://www.example.com" 
         },
         "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"
   }
}