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

0
5 comments

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

Hi Lena 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

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

Has anything changed here?  I am having the same issue.  I need to be able to retrieve a list of issues and have their corresponding sprint assignment returned in the result set.  I was also thinking about using the Link Sprints to Values for Custom Field, but this requires that the user creating the new sprint have admin access to establish the new value for the custom field.

 

Are there any other options?

0

Hi Doug. There were no changes as regards the above, and I would second Lena's suggestion to use the board behavior of linking sprints to a custom field in case your main goal is to receive sprints when you request a list of issues via REST API.

this requires that the user creating the new sprint have admin access to establish the new value for the custom field

Enum fields can have shared or independent sets of values. For fields that use an independent set of values, you only need Update Project permission in the current project to add a value to the field. In this case, it would be enough to grant the user that permission (e.g., as the default Project Admin role) in the relevant project only. 

0

Please sign in to leave a comment.