Get Epic Link for issue via jira-python - jira

When I request a Jira issue via python-jira (jira_session.issue("<KEY>")), the result does not contain the "Epic Link". Can I request to include it or do I need to do a separate query for each issue to get its Epic link?

Is Epic Link in the fields that you see in the issue in the UI?
However https://jira.atlassian.com/browse/JRASERVER-62296 indicates it may be the Epic Name rather than the issue key of the Epic?

Related

Subscribe to Jira search filter using jira Rest API

I have created a Jira search filter, using this request:
POST /rest/api/2/filter
This worked pretty well. Now after I created the filter, I want to get automatically subscribed to it.
Is there a way to do it with the REST API? Or is the only possible way to do this manually?
I already found this in the documentation: https://docs.atlassian.com/software/jira/docs/api/REST/7.4.1/#api/2/filter-createFilter
There, I found the "subscriptions" property, but I can't seem to figure out how exactly I have to write this, to get the correct syntax.
Thanks.
There is a JIRA Feature Request that is still being considered for this to be implemented. Please take a look at this for more details.
For now, all we can do is Fetch or Create Filters using the JIRA ReST APIs but editing the subscriptions should be manual tasks.
Please take a look at the following Atlassian Question which confirms the same.
Details as provided in this Question:
You can do a GET to see the filter subscriptions values you have via:
GET /rest/api/2/filter/favourite?expand=subscriptions
Hope this helps!

JQL to get blocked Issues

Is there a native JQL (not a plugin) that returns tickets that have linked issues listed as "is blocked by" (so I can see all my blocked tickets).
All I have found is linkedIssues() but that can require a specific issue ID to search for which is entirely unhelpful.
I am using Jira Cloud 7.4.
In the core JIRA JQL functionality the closest thing you have, as you've already found out, is linkedIssues() that requires a parent Issue reference.
What you need is Adaptavist ScriptRunner, they have a function called hasLinks(). There are also a handful of other add-ons that offer this functionality but like ScriptRunner, they all cost money.
Related JIRA community question
JIRA Cloud feature request
The below query is also helpful (add it in the filter setup):
project = "Project ID" AND issuetype in (story, Spike) AND Sprint = "Sprint ID" AND linkedIssue in issueHistory()
According to Esther Strom's answer on this Atlassian site, there's a new query type:
Atlassian has very recently introduced a new JQL function called issueLinkType, which can be used in filters, but also in boards.
It's not perfect; if you're already using card colors for something else, you won't be able to use this as well. It also behaves inconsistently when a ticket has links of multiple types. But if you're looking for an easy way to get a view into what might be blocked, and what might have blockers, it works pretty well.
In KQL you can specified the type of link.
For what you want to do here what you can use
issue in linkedIssues([Issue#],"is blocked by")

JQL: How do I search for JIRA issues that link to URLs with a certain pattern?

In Jira, we use regular Web Links to point to an independent issue tracking system (for customer support). Those links can easily be identified by their domain name or URL prefix, e.g., they all have this form:
http://support.mycompany.com/ticket#1234
How can I filter for Jira issues that have links to URLs following this pattern?
The JQL editor does not offer anything related to issue links, and "link" and "URL" are genuinely bad search terms.
ScriptRunner for JIRA offers the Script JQL function "linkedIssuesOfRemote" that searches for issues that have a link to a specific web page, e.g.:
issuefunction in linkedIssuesOfRemote("http://support.mycompany.com/ticket#1234")
will return all issues that link to that page. Instead of the link you might use the link title too.
Unfortunately wildcards are not (yet) supported, thus this doesn't work:
issuefunction in linkedIssuesOfRemote("http://support.mycompany.com/ticket*")
JavaRunner for JIRA 6.28 Does have support for wild card characters so you should be able to support what you need with.
issuefunction in linkedIssuesOfRemote("http://support.mycompany.com/ticket*")

How to get JIRA issues assigned to the current user using the JIRA REST API?

I'm trying to get a list of issues assigned to the current logged in user using the JIRA REST API, but I can't find any documentation on how to do that.
What do I need to do in order to get the issues assigned to the current user?
You can specify the issues you want to receive by using jql.
In your case rest/api/2/search?jql=assignee=currentuser() should do the trick.
Here is the relevant part of the documentation of the REST api and here is the description of the used jql-function.

Link to comment within issue in JIRA

Given an issue in JIRA with multiple comments, is there an easy way to link from one comment to another?
I can use the permalink, but that's a very long and ugly URL. I can also link to e.g. http://jira.example.com/browse/ISSUE-999#action_555213, but that's also rather cumbersome.
Is there a more convenient way? I remember being able to write "#12" in bugzilla to link to comment#12 in a bugzilla issue, but I can't find something similar in Jira.
AFAICT this is unsupported. This was requested by a (paying?) Jira customer a couple of years ago and was shot down: https://jira.atlassian.com/browse/JRA-19537. More recently this was requested again: https://jira.atlassian.com/browse/JRA-28976 and has yet to be addressed by Atlassian.
For now the best you can do is take mliebelt's advice and use the permalink.
Not sure if this is standard, but in the Jira we are using, in the permalink for the comment you want to link to there is a "#comment-NUMBER" part.
When I just used this within the same Jira issue in a comment as a link (e.g. [#comment-NUMBER]), this linked correctly to the other comment without reloading the whole page.
Hope that helps.
Try to add in the comment something like that (hope it works with the wiki syntax here):
This is the text of the comment.
The [comment #5|http://jira.example.com/browse/ISSUE-999#action_555213] bla bla ...
Some more comment.
This is then shown as:
This is the text of the comment.
The comment #5 bla bla ...
Some more comment.
That should be possible if the wiki syntax is allowed for JIRA. See the documentation at Atlassian. The description and comment field are normally shown with the wiki style renderer, so you can hide the ugly URL under a more readable one.
And yes, it uses an absolute URL because JIRA does not allow anything else. I stick to solutions that work now sometimes, even if they may break in the future ... ;-)
Need to add link to hashtag comment number. So basically for any text, insert link and type hash+comment number link this.
So link will not be full link but only hash+comment number.
Tl;dr: find out the comment id attribute and add it prefixed by the "#" symbol to the issue URL. There seems to be no clickable solution right now. Also this solution only semi-works.
Jira comments at the time of writing have an id attribute which contains the comment number. As you may know, you can add an element id attribute as the fragment identifier to jump to it after loading the page.
Hence, URLs like
https://YOUR_JIRA_HOST/browse/ISSUE_NUMBER#COMMENT_ID_ATTRIBUTE
for example
https://myjira.com/browse/Issue-1234#comment-987654
will link to the comment.
From my tests, this only sometimes works. Seems like it's the best option available right now though.
I just discovered today:
There is the "new Jira issue view" which seems to be active by default at least for recent registrations, it doesn't support links to comments.
But if you deactivate the "new issue view" under your accounts Jira Settings ( https://[subdomain].atlassian.net/secure/ViewPersonalSettings.jspa ) > Jira Labs:
You will get the "old jira issue view" that offers a "Permalink" for every comment.
Those permalinks work for everybody, since it renders the issue in the "old jira issue view" even for people that have the "new Jira issue view" enabled.
The link looks like this:
https://[subdomain].atlassian.net/browse/[issueKey]?focusedCommentId=[commentId]&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-[commentId]
Update: Currently if I just add the title of the issue to the body, it will automatically be converted to a link.
i.e. "This is the body of an issue that relates to SAVE-10139 and needs to be completed"
Just using [issueid-nnn] seems to work now (at least in onDemand)

Resources