How to access JIRA cloud rest API?

Ananth Kamaraj
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 6, 2024

Can we access JIRA rest API through python script if our atlassian account does not allows us to create API token? 

I'm able to query directly in browser with API end point, but when I'm trying with Python script I'm getting ConnectTimeout Error

 

Which authentication method will help me in this case except basic authentication as it is not recommended?

3 answers

1 accepted

2 votes
Answer accepted
Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

Hi @Ananth Kamaraj 

Welcome to the community.

No there is no basic auth option anymore to connect to the API from Atlassian.

There is only token based access.

Contact your site/org admins why they don't allow creation of API tokens, or you might need a specific account where they have setup a token for.

They have probably blocked user API token creation

0 votes
David Nickell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

I may be missing something or using the wrong terms.   But I just created a token a minute ago and it works fine....

  1. go to the API Token screen of your profile with Atlassian (Under security): https://id.atlassian.com/manage-profile/security/api-tokens
  2. Generate a token and grab the resulting string
  3. Encode it with your userid, : , and the API token string
  4. I cannot stress how important the format is .... userid+:+API token  (I used to miss the colon
  5. I used this free site - https://www.base64encode.org/
  6. Take the encoded version.  You can now use it in an authorization header.

 

 get an API key  get api key.jpg
 Encode  encode.jpg
 REST ..uh, Use RestUse.jpg

 

 

Marc - Devoteam
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

Hi @David Nickell 

Org admins can set in the administration to disallow users to create personal API tokens

David Nickell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

I think I understand...  In my case, I have an org that has a relationship with Atlassian.  In this case, I am a one-man show and have the domain splitdimedata.com.

As the admin for SplitDimeData@Atlassian, I could say my users can't use API tokens,

That's my read.  If i am way off, please let me know and thank you for the useful information.

 

Like Marc - Devoteam likes this
0 votes
Oliver Siebenmarck _Polymetis Apps_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 6, 2024

Hi @Ananth Kamaraj ,

Welcome to the community!

So, @Marc - Devoteam is right, once an admin deactivates API tokens, the standard way of authentication will not work any more. 

However, there are still options! Whether that's a good idea or a workable approach in your case, I cannot say – you should discuss that with your admins. 

You already noticed how you can use REST endpoints in your browser – that's because your browser has a cookie that tells Atlassian Cloud who you are and that you have been authenticated. It's definitely possible to retrieve that cookie from your browser and then use it in a Python script. I feel obliged to point that this is not a supported technique and most likely something your admin does not want you to do if they already disabled the API tokens. 

The other option would be using an app that manages API keys, like API Key Manager for Jira. This might be an option if you are admins are not generally against API access, but want more control over what API keys are out there and what they can do. Disclaimer: I work for the vendor behind this app, so I might be kind of biased. 

Anyway, hope that helps,
 Oliver

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events