Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,007
Community Members
 
Community Events
165
Community Groups

ADD COMMENT API JIRA WITH VARIABLE

Edited

function parse_jira_ids(){
for ID in "$(echo $log | grep -Po '(TEST-([0-9]{1,}))')"
do
echo $ID

echo "${ID}" > $fileName.txt (WORKING ) ->  Write "TEST-1" in fileName.txt


JIRA_URL_1="https://jira.linx.com.br/rest/api/2/issue/TEST-1/comment"

JIRA_URL_2="https://jira.linx.com.br/rest/api/2/issue/$ID/comment" (NOT WORKING)

curl -k -u 'user':'pass' -X POST --data '{"body": "exemple" }' -H "Content-type: application/json" $JIRA_URL_1 >> aapost-commit.log 2>&1 (working )

curl -k -u 'user':'pass' -X POST --data '{"body": "$ID" }' -H "Content-type: application/json" $JIRA_URL_2 >> aapost-commit.log 2>&1 (NOT working )
done
}

2 comments

I am not do POST when i try send a variable. Some know why????

My best guess is that the $1 is not being expanded in your commands.  I'd try ${ID} instead of $ID

Comment

Log in or Sign up to comment
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you