Hey,
I am trying to query Jira (cloud) using API.
I generated an api-key and ran a quick python script as suggested in several places, such as:
https://stackoverflow.com/questions/12098333/querying-jira-with-python-and-rest
(I also found very similar code snippets here on Atlassian community).
However, I keep getting the same error message:
JIRAError: JiraError HTTP 401 url: https://<myurl>.atlassian.net/rest/api/2/serverInfo
text: Basic authentication with passwords is deprecated. For more information, see: https://confluence.atlassian.com/cloud/deprecation-of-basic-authentication-with-passwords-for-jira-and-confluence-apis-972355348.html
So - the API is failing, and it points me to a deprecation link (though I noticed that it points there even with random erroneous input, so it might not be specific to my bug).
Any idea what I'm doing wrong? My code is provided as well, however it's basically copy paste from stack overflow:
from jira import JIRA
apikey="mykey"
user = 'me@comp'
server = 'https://<comp>.atlassian.net'
options = {'server': server}
jira = JIRA(options, basic_auth=(user,apikey) )
Hi @Iddo Weiner ,
I think you are in the right path, I've seen some issues in previous questions that the APIKEY was not copied correctly and generated this error.
Can you generate a new API Key and re-test it ?
https://confluence.atlassian.com/cloud/api-tokens-938839638.html
Hey @Italo Qualisoni [e-Core] , thanks for answering.
I created a new APIkey, copied it carefully to my code snippet (made sure by eye that it was copied correctly) and ran it again.
I got the same result :/
Maybe I am missing a step? Is there supposed to be an earlier step where I enable API access to the account or something like that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
After you create a new API Key you should be good to use the API using it.
You can check if you are using the correct email as your user variable in your script? Your email is the last item in this page:
https://id.atlassian.com/manage-profile/profile-and-visibility
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.
So you are doing it right, maybe it's something related with your python library?
You can try with curl with something like this
curl -v https://mysite.atlassian.net/rest/api/2/serverInfo --user me@example.com:my-api-token
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Get the same error with curl.
Pretty sure there's a permission problem (401), but I can't understand why..?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am getting the exact same problem: Using correct e-mail and api key. Did you find an answer?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.