Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Automation Rules backup/version control

2 comments

Chris McCullough December 11, 2023

@Luis I was actually going to respond to your message on the linked post but it appears to be deleted now.

I simplified the bash download.sh script a little since I'm only experimenting with this and I have the Cloud ID hardcoded into the curl get request to export the automation rules.

#!/bin/bash

function getAutomationRules() {
response=$(curl -vwX \
--header 'Content-Type: application/json' \
--header 'Cache-Control: no-cache' \
--header 'Authorization: Basic (REDACTED_AUTH_TOKEN)' \
--anyauth \
--location 'https://(REDACTED_DOMAI).atlassian.net/gateway/api/automation/internal-api/jira/(REDACTED_CLOUD_ID)/pro/rest/GLOBAL/rule/export' 2>&1)

HTTP_STATUS=$(echo "$response" | tail -n1)
HTTP_BODY=$(echo "$response" | sed '$d')

if [ "$HTTP_STATUS" = "200" ]; then
echo "$HTTP_BODY" | jq >AutomationRule.json 2>/dev/null
ls -l AutomationRule.json
else
echo "$HTTP_BODY $HTTP_STATUS"
exit 1
fi
}

getAutomationRules


But when it runs, the pipeline still returns a 403 error

< HTTP/2 403
< date: Mon, 11 Dec 2023 16:33:23 GMT
< content-type: application/json
< content-length: 0
< x-amzn-requestid: REDACTED
< x-amz-apigw-id: REDACTED
< x-amzn-trace-id: Root=1-REDACTED;Sampled=0;lineage=73c4f2aa:0
< x-cache: Error from cloudfront
< via: 1.1 REDACTED.cloudfront.net (CloudFront)
< x-amz-cf-pop: HIO52-P2
< x-amz-cf-id: REDACTED
< x-trace-id: REDACTED
< x-frame-options: SameOrigin
< x-content-type-options: nosniff
< x-xss-protection: 1; mode=block
< atl-traceid: REDACTED
< report-to: {"endpoints": [{"url": "https://redacted.cloudfront.net/"}], "group": "endpoint-1", "include_subdomains": true, "max_age": 600}
< nel: {"failure_fraction": 0.001, "include_subdomains": true, "max_age": 600, "report_to": "endpoint-1"}
< strict-transport-security: max-age=63072000; includeSubDomains; preload
< server: AtlassianEdge
<
{ [0 bytes data]

Rick Westbrock February 19, 2024

I the original thread (which was moved) bookmarked to return to later and was disappointed to see today that it has been deleted. Thanks for sharing your script @Chris McCullough so that I'm not totally empty handed by not having access to the original script from @Luis.

Do you happen to have a link to the API documentation for the API endpoint you are using to download the rule definition? There may not be any since it appears to be an internal API.

I am getting back an HTTP 401 Unauthorized error instead of a 403 myself, this was using the eight digit automation rule ID where you show (REDACTED_CLOUD_ID) so maybe I'm not using the right value there.

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events