Developer Portal for YouTrack and Hub 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.

Related Resources

Below you can find the list of resources that let you work with this entity.

Extends WatchFolder

Attributes

This table describes attributes of the SavedQuery entity.

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

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

Field

Type

Description

id

String

The ID of the saved search. Read-only.

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.

visibleFor

UserGroup

Deprecated. Use the readSharingSettings attribute instead.

Group of users that can see this saved search. If the saved search is visible only to its owner, this property is null.

Can be null.

updateableBy

UserGroup

Deprecated. Use the updateSharingSettings attribute instead.

Group of users that can update this saved search. If only the owner of the saved search can update it, this property is null.

Can be null.

readSharingSettings

WatchFolderSharingSettings

Users and groups that can see this saved search. If the saved search is visible only to its owner, this property contains an empty array. Read-only.

updateSharingSettings

WatchFolderSharingSettings

Users and groups that can update this saved search. If only the owner of the saved search can update it, this property contains an empty array. Read-only.

owner

User

The user who created the watch folder. Read-only. 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 a saved search, the user should be either its author or be a part of the user group the 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.youtrack.cloud/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 a saved search, the user should be either its author or be a part of the user group that can edit this 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.youtrack.cloud/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 a saved search, the user should be either its author or be a part of the user group that can edit this 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.youtrack.cloud/api/savedQueries/51-33
Last modified: 18 April 2024