Brent
Brent

Reputation: 31

Is there a way to filter with the new YouTrack REST API?

I have been tasked to build a custom interface for Youtrack and am using the new YouTrack APIs - docs here https://www.jetbrains.com/help/youtrack/standalone/youtrack-rest-api-reference.html. I am querying for a full list of issues which returns 1.17 MB of data. The problem is this takes a while and I only need issues with specific fields ie Priority=1 and Type=Task.

Is there a way to filter with the new APIs so I don't return 1.17 MB of data?

I see that the deprecated APIs (https://www.jetbrains.com/help/youtrack/standalone/deprecated-rest-api-reference.html) have a filter field, but I cannot find one in the new API documentation. I have tried including filter=Priority and filter=Priority(name=1) to see if there are some undocumented filtering methods, but no luck thus far.

Example call: GET https://example.myjetbrains.com/youtrack/api/issues?fields=id,description,fields(id,name,value(id,name)) which returns 1.17 MB of data.

Ideally, I would like to do GET https://example.myjetbrains.com/youtrack/api/issues?filter=Priority(name=1),fields=... or something similar.

Upvotes: 3

Views: 3626

Answers (1)

Alex.V
Alex.V

Reputation: 2116

It's possible to apply a filter to the returned issues list the same way as for the old API. Have a look at https://www.jetbrains.com/help/youtrack/standalone/resource-api-issues.html#get_all-Issue-method. The only difference in this regard is that the field field is called 'query', not 'filter'.

Upvotes: 3

Related Questions