API to get Sprints for a query

I am doing the below API query to get the list of issues in a project. I want to identify the sprints each issues is marked to. I did add sprints but value is not returned. How do I get the sprint for an issue?

/api/issues?query=for: me #Unresolved project:xyz &fields=?fields=created,updated,summary,reporter(name),updater(name),customFields(name,value(name)),sprints,tags(name),numberInProject,project(name),created

3 comments
Comment actions Permalink

Hello,

I'm Lena from the YouTrack team. Thank you for contacting us. 
The main problem is that `sprints` is a sub-resource and can't be used as a part of the fields query. You can get a list of sprints only for a specific issue when you know its ID. You can find an example here: https://www.jetbrains.com/help/youtrack/devportal/resource-api-issues-issueID-sprints.html#get_all-Sprint-method-sample.
Please let me know if you need further assistance. 

0
Comment actions Permalink

Hi Elena Vostrikova,

I am doing automated reporting and monitoring of issues, so we can reduce the manual misses. Fetching individually does not solve the problem, as this could range from 1000+ issues on one call. 

0
Comment actions Permalink

Hello,

Thank you for the details of your scenario. As a possible solution, you can change the board behavior to "Link Sprints to Values for Custom Field". It means that you will have a specific field that will contain the sprint name for each issue, and you will be able to get the value using the query from your original message:

fields=created,updated,summary,your_field

Please let me know if it is suitable for you. 

0

Please sign in to leave a comment.