You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
Hello!
By reading some other discussions here on the community, and in other sites, I've wrote a few python codes trying to get my Jira information into a dataframe and use it. Let me show some attempts:
#1
import requests
import json
header = {
"Autenticate": "TOKEN"
}
request = requests.get(url, headers=header)
resp = json.loads(request.content)
print(resp)
#2
from jira import JIRA
jira = JIRA(basic_auth=('USER', 'PASS'), options={'server':'https://URL.atlassian.net'})
def get_all_issues(jira_client, project_name, fields):
issues = []
i = 0
chunk_size = 100
while True:
chunk = jira_client.search_issues(f'project = {project_name}', startAt=i, maxResults=chunk_size, fields=fields)
i += chunk_size
issues += chunk.iterable
if i >= chunk.total:
break
return issues
issues = get_all_issues(jira, 'PROJECTNAME', ["id", "fixVersion"])
#3
from jira import JIRA
jira = JIRA(server='https://URL.atlassian.net', basic_auth=('USER', 'PASS))
issue = jira.issue('PROJECTNAME-xxx')
print(issue.fields.summary)
#4
from atlassian import Jira
jira = Jira(
url='https://URL.atlassian.net',
username='USER',
password='PASS',
cloud=True)
JQL = 'project = PROJECTNAME ORDER BY updated DESC'
data = jira.jql(JQL)
print(data)
In all of these i got the error (or similar):
{"errorMessages":["The value 'PROJECTNAME' does not exist for the field 'project'."],"warningMessages":[]}
What is missing from my code to connect to the API and get all issues on my project? (about 4k issues there that i'm trying to analyse)
Make sure that you're using basic auth in your first script. Then make sur that you have the correct permission in the project.
By basic auth you mean use
header = {username='USER', password='PASS'}??
And by correct permission you mean admin? I am
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://requests.readthedocs.io/en/latest/user/authentication/
with requests you can use this
requests.get('https://httpbin.org/basic-auth/user/pass', auth=('yourMailAddress', 'Token'))
You need to have access to the project to be able to get the data by API. Do you have access to the issue in the UI ?
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.