Description: Apply watch on existing content.
Notes: For Xray version 3.21.2 and above with Projects, a Project Admin with Manage Security Assets privilege can apply watch on existing content using this REST API in the scope of a project, by using the additional query parameter projectKey.
Security: Requires the "Manage Watches" role to be set on the User or Group level.
Usage: POST /api/v1/applyWatch
Consumes: application/json
Produces: application/json
Query parameters:
Name | Type | Mandatory/Optional | Description |
---|---|---|---|
| string | optional | The project key. |
Request body:
Name | Type | Mandatory/Optional | Description |
---|---|---|---|
watch_names | array | mandatory | Name of the watch/es you want to apply |
date_range | mandatory | Filter Watch resources by a selected date range |
date_range
Name | Type | Mandatory/Optional | Description |
---|---|---|---|
| string | mandatory | The start date you want to apply the watch on. Format: UTC time in RFC3339 YYYY-MM-DDTHH:MM:SSZ Valid format: Later than epoch date (1970-01-01T02:00:00+02:00) |
| string | mandatory | The end date you want to apply the watch on Format: UTC time in RFC3339 formatYYYY-MM-DDTHH:MM:SSZ Valid format: Later than epoch date (1970-01-01T02:00:00+02:00) |
Response body:
Name | Type | Mandatory/Optional | Description |
---|---|---|---|
| string | optional | The error the API received. |
Response codes:
Status Code | Description |
---|---|
202 | Accepted |
400 | One or more fields are missing/invalid |
403 | Permission denied |
404 | Watch name doesn't exist |
500 | Failed to apply the Watch |
Example request:
{ "watch_names":[ "Watcher", "segev-w" ], "date_range": { "start_date": "2001-01-02T00:00:00+02:00" "end_date": "2021-01-02T00:00:00+02:00" } }
Example of successful response:
202 Accepted { "info": "History scan is in progress" }
Example error response:
{ "error": "watch_names is missing" }