It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

JRJC: add and retrieve issue web link

Hi,

Jira supports links from issues to other issues and also links to external Web pages. For example:

jira-issue-links.png

The Issue.getIssueLinks() method appears to only retrieve links to other issues and not the link to the external Web page. E.g., the following code:

System.out.format("Start dumping links for issue %s%n", issue.getKey());
for (IssueLink il : issue.getIssueLinks()) {
System.out.format("- Issue link: %s%n", il);
}
System.out.format("End dumping links for issue %s%n", issue.getKey());

Causes the following to be printed:

Start dumping links for issue OPP-14
- Issue link: IssueLink{targetIssueKey=OPP-7, targetIssueUri=https://deljirauat/rest/api/2/issue/54357, issueLinkType=IssueLinkType{name=Relates, description=relates to, direction=OUTBOUND}}
End dumping links for issue OPP-14

Using the Java REST Java Client (I am using version 5.1.6):

  • How does one retrieve links to Web pages?
  • How does one add a link to a Web page to an issue?

Thanks,

James

 

1 answer

0 votes
Andy Heinzer Atlassian Team Jan 27, 2020

Hi James,

I understand that you're using the JRJC and trying to get back these weblinks in the results.  The reason this is not working is because the REST endpoint you're calling, GET /rest/api/2/issueLink/{linkId}, only is expected to return other Jira issues on this same Jira site.

In this case, in order to get back these weblinks you actually want to be calling a different REST API endpoint, specifically GET /rest/api/2/issue/{issueIdOrKey}/remotelink.  These remote links can be to specific URLs, which typically issue links technically don't do.  You can also create a remote issue link by using the endpoint POST /rest/api/2/issue/{issueIdOrKey}/remotelink.

I hope this helps.

Cheers,

Andy

Hi Andy,

My apologies for not responding sooner - I have been away on annual leave.

As far as I can tell, the JRJC does not support the remotelink endpoint. For this reason, I ended up rolling my own basic Java client (as I only needed to access two endpoints, this did not require too much effort).

Thanks,

James

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you