Update Watch

Xray REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Description: Updates a Watch.

Note: This will overwrite the previous Watch configurations and replace them with the updated parameters.

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 update a Watch 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: PUT /watches/{name}

Consumes: application/json

Produces: application/json

Sample usage:

PUT api/v2/watches/{watch_name}

{
    "general_data": {
        "description": "This is a new watch created using API V2",
        "active": true
    },
    "project_resources": {
        "resources": [
            {
                "type": "all-repos",
                "filters": [
                    {
                        "type": "package-type",
                        "value": "Docker"
                    },
                    {
                        "type": "package-type",
                        "value": "Debian"
                    }
                ]
            }
        ]
    },
    "assigned_policies": [
        {
            "name": "critial_issues",
            "type": "security"
        }
    ],
      "create_ticket_enabled":true,
      "ticket_profile":"test",
      "watch_recipients":["galba@myemail.com","umac@youremail.com"]  
 }

Update Watch in Projects

PUT api/v2/watches/proj-wath?projectKey=<project_key>

Response Codes:

200: Success. Watch was successfully updated

400: Failed to update watch: Watch name is empty

403: Failed to update watch: no permissions

404: Failed to update watch. Watch not found

415: Failed to parse request

500: Failed to update watch

500: Failed to reload block download cache