We have to create and keep up-to-date a set of about 50 automation rules. We'd prefer to automate this via the REST API. Does this automation plugin offer any access to read/write the automation rules?
I'm also interested in the Automation REST API, except for for Cloud.
And would be intersted in testing it as beta
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter,
We currently do offer an offical REST api to mange rules but I have raised a ticket to do this at: AUT-999 - Official REST Api
This is going to be a little more difficult in Cloud than Server but should still be possible using web tokens.
Are you after Cloud or Server?
If you are on Server, it be pretty easy to reverse engineer our REST api. For management it is pretty straight forward GET/PUT/POST stuff.
Though this isn't officially supported.
Cheers,
Nick [Automation for Jira]
Co-Founder
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We're after Server here. Could you point me towards the REST API endpoint, then I can play around with this ;)
Even if it isn't officially supported, this should help.
I'm glad about any sort of documentation (list of endpoints, whatever) you can provide.
Thanks for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nick,
We need to retrieve the Automation for Jira audit log to integrate it with our app. We saw this API currently used in the Audit Log section
https://automation.atlassian.com/pro/rest/GLOBAL/audit?cv=1001.0.0-SNAPSHOT&xdm_deprecated_addon_key_do_not_use=com.codebarrel.addons.automation&lic=none&admin=true&cp=&xdm_e=https://roninpixels.atlassian.net&xdm_c=channel-com.codebarrel.addons.automation__cb-jira-automation-rules&jwt=[XXX]&limit=50&offset=0
But we cannot use it in connect. Any idea how we could get the audit log?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
"We currently do offer an offical REST api to mange rules" - Do you mean 'do not offer ...'? :)
Please advise on the timeline or what we can do to interact with the automation rules via REST API via a Connect App?
Thank you
Yatish
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In case anyone is looking for the endpoints for JIRA Server/Data Center, I found these two.
/rest/cb-automation/latest/project/GLOBAL/rule/<rule_id> PUT To update a rule
/rest/cb-automation/latest/project/GLOBAL/rule GET Returns all rules (still trying to figure out how to get a specific one)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't believe there is an API call to pull a specific rule.
In theory, you could call the global endpoint from A4J itself, and parse the result:
But I just get :
An alternative is to call ScriptRunner to do the call and parse (feels defeatist, but pragmatism must prevail!).
Either way, if you figure it out please share. I've been looking to get to it for over a year.
Bonus marks for building it as an REST endpoint in Scriptrunner ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is an example of the common use case we have in our company. Tens of projects that rely on the same automation and as soon as we initiate another project we need to extend multi-project automation
You need to update base url, have env vars for credentials (admin), and find cloud ID of your instance. Then, knowing your `rule_id` you can get existing rule, add new project to the list and push changes.
Most probably you do not know project ID, thus, script derives it from the project KEY.
total parameters to update: 6
import os
import requests
from requests.auth import HTTPBasicAuth
# Variables
base_url = "https://warthogs.atlassian.net"
api_token = os.getenv("JIRA_API")
jira_email = os.getenv("JIRA_EMAIL")
project_key = "MTC"
rule_id = "16553907"
cloud_id = "<cloud ID comes here>"
# Code Block
auth = HTTPBasicAuth(jira_email, api_token)
headers = {"Accept": "application/json"}
url = (
f"{base_url}/gateway/api/automation/internal-api/jira/{cloud_id}/pro/rest/GLOBAL/rule/{rule_id}"
)
# API endpoint
endpoint = f"{base_url}/rest/api/3/project/{project_key}"
response = requests.get(endpoint, auth=auth)
# Check if request was successful
if response.status_code == 200:
project_details = response.json()
project_id = project_details["id"]
else:
raise SystemExit(1)
# Retrieve the existing automation rule
response = requests.get(url, auth=auth)
if response.status_code == 200:
existing_rule = response.json()
# Modify the rule to make it multi-project
existing_rule["ruleScope"]["resources"].append(
f"ari:cloud:jira:{cloud_id}:project/{project_id}"
)
load = {"ruleConfigBean": existing_rule, "newConnections": []}
# Send the updated configuration to the server
update_response = requests.put(url, json=load, auth=auth, headers=headers)
if update_response.status_code == 200:
print("Automation rule updated successfully")
else:
print("Error updating automation rule:", update_response.status_code, update_response.text)
else:
print("Error retrieving existing automation rule:", response.status_code, response.text)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi all, I would be very keen on this for Jira Cloud. Please advise on how to 'play with' automation rules and configurations via the REST API? Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi there - any update on this please? Is there a roadmap to bring the REST APIs for Cloud and be documented? Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've just found you can use GET url/gateway/api/automation/internal-api/jira/cloudId/pro/rest/GLOBAL/rule/ruleId
to grab a specific rule by id in CLOUD
But unfortunately I can't find anything in terms of updating the rule
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Found it! It's the same API using PUT, with body:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for sharing the information, I have a question and tried it
with my instance "url/gateway/api/automation/internal-api/jira/cloudId/pro/rest/GLOBAL/rule/ruleId" but what headers do you use? Because I get an authorization error and I am already using the API Token, is any other special header used?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'd been using this endpoint successfully for a while to get a list of all our automations.
GET url/gateway/api/automation/internal-api/jira/cloudId/pro/rest/GLOBAL/rule/export
But it seems like rather recently this is no longer returning the rules as it once was, but instead an ID. I'm not sure how to use this ID, however, so back to square 1!
Edit: seems like there's a better endpoint for my purposes now, which you have to POST to
POST url/gateway/api/automation/internal-api/jira/cloudId/pro/rest/GLOBAL/rules
payload:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I noticed this when I was trying to restore an existing automation - I've figured out that the ID is actually the download UUID, so you can retrieve the list of automations from there
"/gateway/api/automation/internal-api/jira/<cloud-id>/pro/rest/GLOBAL/rule/export/<id-response>/download"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, I used to use POST url/gateway/api/automation/internal-api/jira/cloudId/pro/rest/GLOBAL/rules
to get a list of Automations, but now it returns 403.
Is this endpoint still working well for you?
Do you have any idea how to get the Automations otherwise?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I needed to grab a session cookie, but unfortunately it's not an easy way.
Essentially I had to hit F12 while I was on the global automation UI in Atlassian to grab the tenant.session.token, and once that was set as the Cookie header, everything worked fine again. But it looks like that expires every month, which would mean this token potentially needs to be updated 12 times a year.. not the best but not the worst!
If anyone else has a better way, please let me know!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for sharing, I suspect it has to do with the authentication method, are you using oAuth or an API token?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can this endpoint be used to pull the audit log for all automation rules?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
any documentation on how this could be achieved would be highly appreciated
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Any updated on movement on this please for Jira Cloud? Thank you
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Likewise, AI need this for Data Center!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.