JIRA REST API - retrieving issue links

Simon O'Beirne April 14, 2014

Hi,

I'm trying to retrieve a list of linked issues for a given issue key, using http://jira/rest/api/latest/issue/{key}

I'm getting an issue links array returned if I fetch a story, but not if I fetch a dev issue which is linked to that story.

It would appear that JIRA is only returning issue links from one side of the relationship, but I have looked at this previously and didn't think this was the case.

Is this correct? And if so, is there an easy way of including the issue links in the returned object, without a separate JQL search of "issue in issuelinks("{key}")" ?

JIRA version: v6.1.3#6158

Many thanks,

Simon

14 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

6 votes
Konrad Garus
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.
June 17, 2017

There is one more way to do it. Try the /issue/{key}/remotelink endpoint, like https://ecosystem.atlassian.net/rest/api/2/issue/ACJIRA-884/remotelink.

Docs for 6.4: https://docs.atlassian.com/jira/REST/6.4.9/#d2e1131

 

 

Junio Fernandes August 15, 2018

That's the way! Tks.

Valentina_Palacin November 6, 2018

Life saver! This option helped me with retrieving the Wiki Page linked to the issue. Thanks!!!

Erik Macias February 21, 2019

@Simon O'Beirne I would consider marking this answered with Konrad Garus' answer. 

1 vote
Konrad Garus
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.
March 15, 2017

The links are between all the other regular fields.

To use a publicly available JIRA instance as an example, have a look at: https://ecosystem.atlassian.net/rest/api/2/issue/ACJIRA-884. The response includes the following:

{
  "key": "ACJIRA-884",
  "fields": {
    "issuelinks": [
      {
        "id": "101800",
        "self": "https://ecosystem.atlassian.net/rest/api/2/issueLink/101800",
        "type": {
          "id": "10000",
          "name": "Relate",
          "inward": "is related to",
          "outward": "relates to",
          "self": "https://ecosystem.atlassian.net/rest/api/2/issueLinkType/10000"
        },
        "outwardIssue": {
          "id": "196300",
          "key": "ACJIRA-1221",
          "self": "https://ecosystem.atlassian.net/rest/api/2/issue/196300",
          "fields": {
            "summary": "The {board.id} context parameter is empty in jira-projects-plugin:sidebar-panel location",
            "status": {
              "self": "https://ecosystem.atlassian.net/rest/api/2/status/1",
              "description": "",
              "iconUrl": "https://ecosystem.atlassian.net/images/icons/statuses/open.png",
              "name": "Open",
              "id": "1",
              "statusCategory": {
                "self": "https://ecosystem.atlassian.net/rest/api/2/statuscategory/2",
                "id": 2,
                "key": "new",
                "colorName": "blue-gray",
                "name": "To Do"
              }
            },
            "priority": {
              "self": "https://ecosystem.atlassian.net/rest/api/2/priority/3",
              "iconUrl": "https://ecosystem.atlassian.net/images/icons/priorities/major.svg",
              "name": "Major",
              "id": "3"
            },
            "issuetype": {
              "self": "https://ecosystem.atlassian.net/rest/api/2/issuetype/4",
              "id": "4",
              "description": "An improvement or enhancement to an existing feature or task.",
              "iconUrl": "https://ecosystem.atlassian.net/secure/viewavatar?size=xsmall&avatarId=15310&avatarType=issuetype",
              "name": "Improvement",
              "subtask": false,
              "avatarId": 15310
            }
          }
        }
      }
    ]
  }
}

Similarly, if we check the linked issue, we'll see a reverse link: https://ecosystem.atlassian.net/rest/api/2/issue/ACJIRA-1221

0 votes
Mumtaz Ahmad November 2, 2017

Any solution to this? This issue is making my scripts useless...

0 votes
Konrad Garus
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.
March 15, 2017

Do you have the permission to see the links, on the account used for authentication on this request? That's the only possible explanation that comes to my mind right now.

Andreas Krey June 16, 2017

At least I do. I see linked issues when watching the issue page, but the REST api does not return them under the same user, or even in the same browser. E.g.

https://wetrack.$company.com/rest/api/latest/issue/KEY-17356?fields=issuelinks

yields:

{
  "expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",
  "id": "990120",
  "self": "https://wetrack.$company.com/rest/api/latest/issue/990120",
  "key": "KEY-17356"
}

Without the 'fields=issuelinks' I get a lot of fields, but still no links.

It works as expected with the aforementioned https://ecosystem.atlassian.net/rest/api/2/issue/ACJIRA-884?fields=issuelinks

Mine is v6.4.12, ecosystem doesn't show a version?

Konrad Garus
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.
June 17, 2017

There is one more way to do it. Try the /issue/{key}/remotelink endpoint, like https://ecosystem.atlassian.net/rest/api/2/issue/ACJIRA-884/remotelink.

Docs for 6.4: https://docs.atlassian.com/jira/REST/6.4.9/#d2e1131

(sorry, posted it as a top-level answer first)

Andreas Krey June 17, 2017

Kudos for fast reaction, but remotelink is '[]' as well.

And on ACJIRA-884 internal issuelinks and /remotelinks are different - issuelinks point to other issues, and /remotelinks to confluence/other jira instance).

Konrad Garus June 17, 2017

I'm out of ideas. remotelinks being cross-app makes sense.

You may have some luck asking Atlassian for support...

Andreas Krey June 20, 2017

It turns out that issuelinks are present in the API for some projects (evem when the value is []), but not for all. So it seems to be a project setup thing.

0 votes
Sanu Soman
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.
March 15, 2017

Thanks for the reply. But my problem is I am not at all getting any information on the linked issues on a specific project issues even I try with https://JIRAURL/rest/api/latest/issue/ISSUENUMBER

0 votes
Konrad Garus
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.
March 15, 2017

Sanu - see my answer.

0 votes
Sanu Soman
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.
March 15, 2017

@Konrad Garus - Sorry, then how could I find linked issue details?

0 votes
Konrad Garus March 9, 2017

Sanu - it's buried in the fields. Not a top-level property, just another regular field.

0 votes
Sanu Soman
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.
March 8, 2017

@Konrad Garus - When I am trying with https://JIRAURL/rest/api/latest/issue/ISSUENUMBER?fields=issuelinks, getting output, 

{code}

{ 

 "expand": "renderedFields,names,schema,transitions,operations,editmeta,changelog",

 "id": "904303",

 "self": "https://JIRAURL/rest/api/latest/issue/904303",

 "key": "ISSUENUMBER"}

{code}

Which is not having any info on remote link issue details. Here issue number is the one I mentioned on the rest call.

 

 

0 votes
Konrad Garus March 8, 2017

Sanu - the links are available on the issues, as regular fields.

0 votes
Sanu Soman
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.
March 8, 2017

Hi All - Did you able to get a solution for this issue? I am also facing similar issue. Please help.

0 votes
Konrad Garus
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.
August 30, 2016

I'm having the same issue.

0 votes
Deleted user March 20, 2015

Did you find a solution?

0 votes
Boris Georgiev _Appfire_
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.
April 14, 2014

JIRA should return all links. Can you attach your request and response here ?

Also you might try adding ?fields=*all to the request URL, so all fields are returned.

https://docs.atlassian.com/software/jira/docs/api/REST/latest/#d2e3932

Simon O'Beirne April 15, 2014

Hi Boris,

Request and response as follows (I've anonymised the names/descriptions etc, but replaced the two keys as PROJECT-1 and PROJECT-2). I also formatted the JSON for readability.

As you can see, PROJECT-2's response displays the issue links correctly, one of which is for PROJECT-1. But PROJECT-1 does not return any issue links at all.

Both requests were made with the format:

http://jira/rest/api/2/issue/PROJECT-1?fields=*all

(PROJECT-1 response.txt)

(PROJECT-2 response.txt)

Many thanks

Simon

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events