How to view and delete Jira Service Management legacy automation through REST API
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
When a Jira administrator needs to read or delete legacy automation rules, such as when the UI is not working properly, or the admin needs an automated format, REST API is a good alternative.
Environment
- Jira Service Management
- Legacy automation already set.
Solution
Initially, the rule number is required to run the following commands. You can get them from:
- UI, by clicking to edit the legacy rule (the number will appear in the URL, after the ruleset, as the example "http://localhost:8080/servicedesk/admin/SM/automation/ruleset/16", where 16 is the rule number. Or
- Through the database with "select * from "AO_9B2E3B_RULESET_REVISION""
With the rule number (the ruleset number), the REST API to retrieve the legacy rule information is 'GET <jira-url>/rest/servicedesk/automation/1/ruleset/<rule-number>'. As an example from a lab:
% curl --location --request GET 'http://localhost:8080/rest/servicedesk/automation/1/ruleset/16' -u dalves:dalves | python3 -m json.tool
{
"id": 16,
"name": "comment",
"description": "comment rule",
"link": {
"href": "http://localhost:8080/rest/servicedesk/automation/1/ruleset/16",
"rel": "self"
},
"rules": [
(...)
"validation": {
"globalErrors": [],
"fieldErrors": {}
},
"activeRevisionId": 16
}
To remove the rule, use the REST API 'DELETE <jira-url>/rest/servicedesk/automation/1/ruleset/<rule-number>'. As an example from a lab:
% curl --location --request DELETE 'http://localhost:8080/rest/servicedesk/automation/1/ruleset/16' -u dalves:dalves -v
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
* Server auth using Basic with user 'dalves'
> DELETE /rest/servicedesk/automation/1/ruleset/16 HTTP/1.1
(...)
< HTTP/1.1 200
(...)
< Date: Tue, 17 Sep 2024 14:19:03 GMT
<
* Connection #0 to host localhost left intact
Note that when removing no output is seen, only status 200 if issuing the command with verbose flag ("-v").