Get Watch

Xray REST APIs

ft:sourceType
Paligo

Description: Gets a named watch

API Version: v2

Security: Requires the "Manage Watches" role to be set on the User or Group level.

Notes: For Xray version 3.21.2 and above with Projects, a Project Admin with Manage Security Assets privilege can get a list of Watches using this REST API in the scope of a project, by using the additional query parameter projectKey. A Watch can include both Global and Project Policies.

Usage: GET /watches/{name}

Produces: application/json

Sample Response:

GET api/v2/watches/vuln-prod

{
    "general_data": {
                "id": "56sdf564b0fe4dc29f64cdfs564",
        "name": "vuln-prod",
        "description": "This is a new watch created using API V2",
        "active": true
    },
    "project_resources": {
        "resources": [
            {
                "type": "repository",
                "bin_mgr_id": "art-prod-eu",
                "name": "libs-release-local",
                "filters": [
                    {
                        "type": "regex",
                        "value": ".*"
                    }
                ]
            }
        ]
    },
    "assigned_policies": [
        {
            "name": "medium_policy",
            "type": "security"
        }
    ]
}

Get Watch in Projects

GET api/v2/watches/proj-watch?projectKey=<project_key>
{
    "general_data": {
        "id": "56sdf564b0fe4dc29f64cdfs564",
        "name": "proj-watch",
        "description": "This is a new watch created using API V2",
        "active": true,
        "project_key": "myproj"
    },
    "project_resources": {
        "resources": [
            {
                "type": "repository",
                "bin_mgr_id": "art-prod-eu",
                "name": "libs-release-local",
                "filters": [
                    {
                        "type": "regex",
                        "value": ".*"
                    }
                ]
            }
        ]
    },
    "assigned_policies": [
        {
            "name": "medium_policy",
            "type": "security"
        }
    ]
}