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

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bash Curl and Jira RESTAPI not working

Hello,

I am new to Jira and it is not my core competency. I am just trying to create BASH script, This script will read a text file with jira issues, complete the non jira task and update the jira issue.

I am using the curl to update the jira. like below

curl -D- -k -u $WINDOWS_USERNAME:'$WINDOWS_PASSWORD' -X PUT --data '{\"name\":\"$WINDOWS_USERNAME\"}' -H \"Content-Type:application/json\" https://jira.XXXXXXcom/rest/api/2/issue/$TASKNO/assignee"

 

This works from command prompt. But when run through the script. I get some time password issues and CAPTCHA issues and need Jira admin help to clear the account.

 

is there a better way like OAUTH or cookies and how to use then in bash script?

help is appreciated?

 

1 answer

@bhushan walde 

 

Hi Bhushan

welcome to the Atlassian community.

You should have a look to personal access tokens which are available starting with Jira 8.14 

https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html

Cheers

 

Kurt

thank You Kurt fort helping....

 

Hope I will get it right.

 

Cheers

Bhushan

Kurt,

I hope you will be able to help me here.

After looking into this, I just realized that our Jira version is 8.13.

So which method I should be using to connect to JIRA using CURL in Version 8.13?

 

Cheers

Bhushan

@bhushan walde 

 

Hi Bhushan

 

https://developer.atlassian.com/server/jira/platform/security-overview/ lists the potential options pre 8.14 which are basic auth, cookie based and oauth.

 

Oauth would be the preferred one but i am not sure how this would be done in a bash script. 

 

If a language like python would be an option, than you could take a look at https://shreya-goyal.medium.com/authenticating-jira-rest-api-in-python-and-creating-issues-oauth-4780c58fd478

 

Cheers

Kurt

Thank your Kurt,

look like I got what I wanted, The problem with bash is that escape characters need to be added at every double quotes. I will update the thread once I am confident that I resolved all issues and script is working correctly.

 

regards

Bhushan

Suggest an answer

Log in or Sign up to answer
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