I've been manually looking at reports from Jira Software like the Burndown Chart to generate some metrics on team performance. One of the things I've been looking at is how many issues are added or removed from a sprint after it's started (to gauge how much the team's focus may have shifted after planning).
If I look at the Burndown Chart, I get a list of stories at the start of the sprint and then a list of "significant events" like when issues are completed, estimates changed, or an issues is added to or removed from the sprint. I've started working on a way to automate this analysis with the REST API but have run into an issue.
Consider a story with the issue key FOO-42. Sprint 5 was started with FOO-42 as part of the plan but it was later moved out of the sprint. This is clearly visible on the Burndown Chart report. However when I run a JQL query looking for all issues in Sprint 5, FOO-42 doesn't show up. If I go look at the history for this story, I can see where the "Sprint" value changed from "Sprint 5" to null, and I've seen other issues that have multiple sprints (e.g., "Sprint 5, Sprint 6, Sprint 7") in the "Sprint" field if they were carried over from one sprint to the next. Those show up fine in my queries but instances where an instance was simply moved out of a sprint are not.
How does Jira internally know that an issue like FOO-42 was once part of a sprint for reporting purposes? Is there a way I can efficiently access the same information through the REST API?