Update Watch

Xray REST APIs

Products
JFrog Xray
Content Type
REST API
ft:sourceType
Paligo

Description: Updates a Watch.

Notes: This will overwrite the previous Watch configurations and replace them with the updated parameters. You cannot update the project_key property. A Watch can include both Global and Project Policies.

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

Usage: PUT /xray/api/v2/watches/{name}

Consumes: application/json

Produces: application/json

Path Parameters:

Name

Type

Required/Optional

Description

name

string

required

Name of the watch to be updated

Query Parameters:

Name

Type

Required/Optional

Description

projectKey

string

optional

Project key for scoped updates

Request Body:

Name

Type

Required/Optional

Description

general_data

GeneralDataObj

required

General data for the Watch

project_resources

ProjectResourcesObj

optional

Resources the watch is applied on.

It may be omitted only if general_data.active is false or omitted.

watch_recipients

array[string]

optional

Email addresses to receive Watch notifications

assigned_policies

array[AssignedPolicyObj]

optional

Policies assigned to the Watch

create_ticket_enabled

boolean

optional

Indicates whether Jira ticket creation is enabled

ticket_profile

string

optional

Jira profile for ticket generation

ticket_generation

TicketGenerationObj

optional

Ticket generation settings for the Watch

GeneralDataObj:

Name

Type

Required/Optional

Description

name

string

required

Name of the Watch

description

string

optional

Description of the Watch

active

boolean

optional

Indicates if the Watch is active or not.

Default:

  • true if the Watch is applied on some resources (project_resources is included)

  • false If the Watch is not applied on any resource ( project_resources is omitted or no resource or omitted).

ProjectResourcesObj:

Name

Type

Required/Optional

Description

resources

array[ResourceObj]

required

Resources to watch and associated Policies

ResourceObj:

Name

Type

Required/Optional

Description

type

string

required

Type of the resource.

Valid values: repository, build, releaseBundle, releaseBundleV2, all-repos, all-builds,  all-releaseBundles, all-releaseBundlesV2, all-projects

repo_type

string

optional

Type of repository.

Valid values: local, remote

bin_mgr_id

string

optional

Binary manager ID. Omit or set to default.

name

string

required

Name of the resource

filters

array[FilterObj]

optional

Filters to apply to the resource.

FilterObj:

Name

Type

Required/Optional

Description

type

string

required

Type of the filter. The acceptable filter type depends on the resource type.

For the resource types repository and all-repos:

  • regex: Regular expression artifact's name filter.

  • path-regex: Regular expression artifact's repo path filter.

  • package-type: artifact’s package type filter.

  • mime-type: artifact’s MIME type filter.

  • property: artifact’s custom property filter.

  • path-ant-patterns: artifact's repository path ant-style pattern filter.

For the resource types all-builds, all-releaseBundles, all-releaseBundlesV2, all-projects:

  • ant-patterns: Ant-style path pattern filter applied to the resource name.

For the resource types repository, build, releaseBundle, releaseBundleV2:

  • None

value

varies

required

Value of the filter, whose type depends on the filter type.

For path-ant-patterns and ant-patterns types:

PatternObj

required

arrays of ant-style include and exclude path patterns.

For regexand path-regextypes:

string

required

A regular expression string.

For package-type type:

string

required

One of the following package types:  Maven, Docker, NuGet, Generic, Npm, Bower, Pypi, Rpm, Debian, RubyGems

For mime-type type:

string

required

A MIME-type string.

For property type:

KeyValueObj

required

A custom property's key-value pair.

PatternObj:

Name

Type

Required/Optional

Description

IncludePatterns

array[string]

optional

arrays of ant-style include path patterns.

ExcludePatterns

array[string]

optional

arrays of ant-style exclude path patterns.

KeyValueObj:

Name

Type

Required/Optional

Description

key

string

required

The key name of a custom property's key-value pair.

value

string

required

The value of a custom property's key-value pair.

AssignedPolicyObj:

Name

Type

Required/Optional

Description

name

string

required

Name of the policy

type

string

required

Type of the policy (e.g., security, license)

Acceptable values: security, license, operational_risk

TicketGenerationObj:

Name

Type

Required/Optional

Description

create_duplicate_tickets

DuplicateTicketCreationObj

optional

Settings for creating duplicate tickets

impact_path_profiles_mapping

array[ImpactPathProfileMappingObj]

optional

Mapping of impact path profiles

DuplicateTicketCreationObj:

Name

Type

Required/Optional

Description

by_version

VersionTicketSettingsObj

optional

Settings for creating duplicate tickets by version

VersionTicketSettingsObj:

Name

Type

Required/Optional

Description

build

boolean

optional

Indicates whether duplicate tickets are created for builds

package

boolean

optional

Indicates whether duplicate tickets are created for packages

release_bundle

boolean

optional

Indicates whether duplicate tickets are created for release bundles

ImpactPathProfileMappingObj:

Name

Type

Required/Optional

Description

include

array[IncludeObj]

optional

Settings for mapping impact paths to JIRA profiles

IncludeObj:

Name

Type

Required/Optional

Description

profile

string

required

Impact path profile

pattern

string

required

Pattern for the impact path corresponding to profile

Response Body

Name

Type

Description

info

string

Success info message

error

string

Error message text

Response Codes

Status code

Description

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 the watch. Watch not found

415

Failed to parse request

500

Failed to update watch

500

Failed to reload block download cache

Example Request

{
    "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":["mymail@acme.com","umac@youremail.com"]  
}

Update Watch in Project scope

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