Efficient Way to Detect Removed Issues in Jira Scopes

Hi everyone,

I’m working on a product that integrates with Jira to collect and analyze issues from our customer’s Jira enterprise instance, providing insights and updates in our product. Currently, we batch this process nightly, but we’re looking to shift to more frequent updates to enable new UX features.

Our current approach involves increasing the frequency of API calls and querying for issues created or updated since the last call. However, this approach doesn’t help us detect if an issue has been removed from a specific scope. This becomes a problem as having stale issues in our UI could lead to inaccuracies.

While one alternative is to fetch all issues and compare them to detect removals, this method takes over 2 hours with our current setup and is expected to become even slower as the number of issues grows.

Here are our specific questions:

  1. Is there a more efficient way to determine if issues have been removed from a scope without fetching all issues?
  2. I’ve heard of Jira expressions but am unsure if they can address this problem. Does anyone have experience or insights on using Jira expressions for such use cases?
  3. Are there other clever techniques or best practices for quickly identifying removed issues?

Any advice or related experiences would be greatly appreciated!

Thanks in advance!

Hello @jamisonproctor

This is an age-old problem that all Jira devs have faced when wanting the know the change of state of one or more issues among all the issues in an instance. The classic “fetch all and compare to a dataset” technique does not scale.

You really need to totally reconsider your approach. Start thinking about using Webhooks and building an app that listens for the jira:issue_deleted event.

This way, every time an issue is deleted, you know about it in real time, and can add it to your dataset.

You could also use the audit log to get the deleted issues.
For this you need to change the audit log setting End user activity under Coverage to at least Advanced. (see also How to find which user deleted a Jira issue | Jira | Atlassian Documentation)
Then use GET /rest/api/2/auditing/record (see Jira 9.17.0) with the filter parameter set to “Issue deleted” (or whatever the exact wording is).

1 Like