How to retrieve automation rule execution count in Jira Data Center via REST API
Platform Notice: Data Center and Cloud By Request - This article was written for the Atlassian Data Center platform but may also be useful for Atlassian Cloud customers. If completing instructions in this article would help you, please contact Atlassian Support and mention it.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Sometimes it is helpful to understand how frequently a rule is executing over a certain period of time. Viewing the performance insights of automation rules in the UI does give some level of information but it is not grouped by date range and you are not able to customize the date range beyond 1h, 1d, 1w, and 1m.
You can use the REST API endpoint used by the View performance insights function to pull data over a custom date range and in the resulting JSON it will include a total of rule executions for each rule during that range.
Environment
Jira Data Center
Solution
Copy the url below and update the <baseURL>, startTime=<yyyy-mm-dd>T00%3A00%3A00Z, and endTime=<yyyy-mm-dd>T23%3A59%3A00Z placeholders.
1
<baseURL>/rest/cb-automation/latest/insight/GLOBAL/rule?&startTime=<yyyy-mm-dd>T00%3A00%3A00Z&endTime=<yyyy-mm-dd>T23%3A59%3A00Z&sortField=EXECUTION_COUNT&sortOrder=DESC&limit=99
Example:
1
https://testjira.com/jira/rest/cb-automation/latest/insight/GLOBAL/rule?&startTime=2024-08-01T00%3A00%3A00Z&endTime=2024-08-08T23%3A59%3A00Z&sortField=EXECUTION_COUNT&sortOrder=DESC&limit=99
Paste the url in the browser window where you are logged in to Jira.
JSON returned should include total executions, success, no actions performed, and some error quantities for all rules in the instance.
Last, we will want to execute the SQL query below to retrieve the list of automation rules, which will include the rule ID, in order to identify the execution quantity for the rule/s in question.
1
select "AO_589059_RULE_CONFIG"."ID", "AO_589059_RULE_CONFIG"."NAME" as "Rule Name" from "AO_589059_RULE_CONFIG"
Was this helpful?