YouTrack Standalone 2020.6 Help

Operations with Specific SavedQuery

This resource lets you access and work with saved searches in YouTrack.

Resource

/api/savedQueries/{queryID}

Returned entity

SavedQuery. For the description of the entity attributes, see Supported Fields section.

Supported methods

SavedQuery attributes

Represents a saved search.

Extends WatchFolder

This table describes attributes of the SavedQuery entity.

  • To receive an attribute in the response from server, specify it explicitly in the request parameter fields.

  • To update an attribute, provide it in the body of a POST request.

Field

Type

Description

query

String

The query that is saved in this search. Can be null.

issues

Array of Issues

The collection of issues that match this saved search. Read-only.

owner

User

A user who created — hence, owns — the watch folder. Read-only. Can be null.

visibleFor

UserGroup

Group of users that can see this watch folder. If the folder is visible only for its owner, this property is null. Can be null.

updateableBy

UserGroup

Group of users that can update this watch folder. If only the folder's owner can update it, this property is null. Can be null.

name

String

The name of the issue folder. Can be null.

Read a Specific SavedQuery

Read settings of the saved search with the specified ID.

Required permissions

To view saved search user should be either it's author or be a part of the user group saved search is shared with.

Request syntax

GET /api/savedQueries/{queryID}?{fields}

{queryID}

Database ID of the saved search.

Request parameters

Parameter

Type

Description

fields

String

A list of SavedQuery attributes that should be returned in the response. If no field is specified,only the entityID is returned

Sample

Sample request

https://example.myjetbrains.com/youtrack/api/savedQueries/51-33?fields=id,name,query,owner(login,name),visibleFor(name,id),issues(id,idReadable,summary)

Sample response body

{ "query": "Priority: Major #Unresolved", "issues": [ { "idReadable": "SP-38", "summary": "New summary", "id": "2-42", "$type": "Issue" } ], "visibleFor": null, "owner": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "name": "Unresolved Major", "id": "51-33", "$type": "SavedQuery" }

Update a Specific SavedQuery

Update settings of the saved search with the specified ID.

Required permissions

To update saved search user should be either it's author or be a part of the user group that can edit saved search.

Request syntax

POST /api/savedQueries/{queryID}?{fields}

{queryID}

Database ID of the saved search.

Request parameters

Parameter

Type

Description

fields

String

A list of SavedQuery attributes that should be returned in the response. If no field is specified,only the entityID is returned

Sample

Sample request

https://example.myjetbrains.com/youtrack/api/savedQueries/51-33?fields=id,name,query,owner(login,name),visibleFor(name,id),issues(id,idReadable,summary)

Sample request body

{ "query": "in: SP Priority: Major #Unresolved", "visibleFor": {"id":"3-2"}, "name": "Major Unresolved in SP" }

Sample response body

{ "query": "in: SP Priority: Major #Unresolved", "issues": [ { "idReadable": "SP-38", "summary": "New summary", "id": "2-42", "$type": "Issue" } ], "visibleFor": { "name": "Sample Project Team", "id": "3-2", "$type": "UserGroup" }, "owner": { "login": "john.doe", "name": "John Doe", "$type": "User" }, "name": "Major Unresolved in SP", "id": "51-33", "$type": "SavedQuery" }

Delete a Specific SavedQuery

Delete the saved search with the specified ID.

Required permissions

To delete saved search user should be either it's author or be a part of the user group that can edit saved search.

Request syntax

DELETE /api/savedQueries/{queryID}

{queryID}

Database ID of the saved search.

Request parameters

Parameter

Type

Description

fields

String

A list of SavedQuery attributes that should be returned in the response. If no field is specified,only the entityID is returned

Sample

Sample request

https://example.myjetbrains.com/youtrack/api/savedQueries/51-33
Last modified: 30 March 2021