Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can't get issuelinks types (names) and key with Python

Filipe Fantini
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!
September 30, 2020

Hi!

I'm trying to get some information from Jira Software (server) via Python script. What I have to do is:

- Get key, summary, issuetype and status from issues based on a JQL filter - DONE

- Get what issues are linked to these issues I've just got, like, which issues are blocked by or blocks other issues? I need the key of these issues, but when I use issue_link = [issue.fields.issuelinks]  command, it just gives me some number which are not the issue key - PROBLEM HERE

See my code bellow:

key_blk = [issue]
issuetype = [issue.fields.issuetype]
summary_blk = [issue.fields.summary]
status_blk = [issue.fields.status]
issue_link = [issue.fields.issuelinks] 

for i in jira.search_issues('project = GPD AND issueLinkType in (blocks, "is blocked by")', maxResults=5):
issue=i
key_blk.append(issue)
issuetype.append(issue.fields.issuetype)
summary_blk.append(issue.fields.summary)
status_blk.append(issue.fields.status)
issue_link.append(issue.fields.issuelinks) 

a = {'key': key_blk, 'issuetype': issuetype , 'Summary': summary_blk, 'Status': status_blk,'link':issue_link}
df = pd.DataFrame.from_dict(a, orient='index')
df.transpose()

 

Example of result from 'link' column: [58209]

Does anyone knows how to solve it?

Thanks in advance :)

1 answer

1 accepted

0 votes
Answer accepted
Niranjan
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.
September 30, 2020

Hi @Filipe Fantini ,

I believe that is the issue number. You may need to use another call to get the linked issue number 58209 and retrieve the issue key. I am not sure about python, but via restapi we can get it via /rest/api/2/issue/58209?fields=key . This may work :)

Filipe Fantini
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!
October 9, 2020

Hi @Niranjan , I've been trying but I think I'm doing wrong in terms of code syntax/logic, but your idea is awesome, I didn't realize that! 

About restapi I've not much knowledge honestly, but I'll search deeper about that.

Many thanks!!! :D

Like Niranjan likes this

Suggest an answer

Log in or Sign up to answer