Finding issues that have moved projects

Rodney Sawyer April 26, 2012

When using the REST API to update a ticket (XML-RPC), we have a use case where the ticket may have moved to a different project, but the client still knows it having the first key. ie, the issue was created having key AD-13362 but was then move to ED-236. In the actual Jira interface you could search for AD-13362 and ED-236 would come up, however this does not work with the API.

My question is, has anyone had a use case like this? And is there a workaround to have the API know that AD-13362 is now ED-236?

4 answers

1 vote
Jobin Kuruvilla [Adaptavist]
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 26, 2012

There is nothing possible using the current APIs. If you are okay to write a plugin, you can expose it as a new REST method!

Lee Correll
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 26, 2012

I'm having the same problem - but I think there's an answer with the REST API. The reason I say that is that i'm using CURL - and if I grab all of the data in JSON format for one of my issues, moved from another project, there is an "inward" reference to the originating project. See below, an excerpt from a CURL query - the issue moved to is ENG-4500; the issue moved from is IECCH-3, and there are relations to 2 other issues - an ENG and an AH issue.

{"id":"58944","self":"https://[our company].jira.com/rest/api/2/issueLink/58944","type":{"id":"10010","name":"Related Issues","inward":"Related To","outward":"Related To","self":"https://[our company].jira.com/rest/api/2/issueLinkType/10010"},"outwardIssue":{"id":"67188","key":"AH-1221","self":"https://[our company].jira.com/rest/api/2/issue/67188","fields":{"summary":"Print Invoice","status":{"self":"https://[our company].jira.com/rest/api/2/status/6","description":"The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.","iconUrl":"https://[our company].jira.com/images/icons/status_closed.gif","name":"Closed","id":"6"},"issuetype":{"self":"https://[our company].jira.com/rest/api/2/issuetype/20","id":"20","description":"Bug","iconUrl":"https://[our company].jira.com/images/icons/bug.gif","name":"Bug SubTask","subtask":true},"priority":{"self":"https://[our company].jira.com/rest/api/2/priority/3","iconUrl":"https://[our company].jira.com/images/icons/priority_major.gif","name":"Major","id":"3"}}}},{"id":"58943","self":"https://[our company].jira.com/rest/api/2/issueLink/58943","type":{"id":"10010","name":"Related Issues","inward":"Related To","outward":"Related To","self":"https://[our company].jira.com/rest/api/2/issueLinkType/10010"},"outwardIssue":{"id":"83303","key":"ENG-4134","self":"https://[our company].jira.com/rest/api/2/issue/83303"...

and

there's a reference to "inwardIssue":{"id":"81331","key":"IECCH-3","self":"https://[our company].jira.com/rest/api/2/issue/81331",..

So there are references that can be accessed using the keys - extracting them easily seems to be the challenge at the moment. If I could craft a JSON and use a GET properly, I believe I could extract this info.

Jobin, am I mistaken? Or is it that it's not possible to craft a JSON entry that way?

Jobin Kuruvilla [Adaptavist]
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 26, 2012

inward and outward are used to show linking between the issues. It can be absent if there are no links. And it doesn't give you anything to show the old issue key. So you are looking at the wrong thing!

Lee Correll
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 27, 2012

Ah, got it - because we are actually cloning the original issue and then moving the clone to another project. So the original issue is tracking the clone, and when we use the move issue wizard, JIRA substitutes the new project issue with the original cloned issue.

You're saying that if we moved the original issue, there would be no "track-back"? Clearly, there's some way for JIRA to do it - it's just that the REST API can't do so, if I understand correctly.

Jobin Kuruvilla [Adaptavist]
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 27, 2012

That's right! it is just the REST API can't do it, yet!

0 votes
Serge Prud'homme April 25, 2014

I found I could use the the jira browse web interface and parse the html for the new ID.

http://jira.atsana.com/browse/JIRAPROJECT-123

will return an entry with the either the same JIRA ID or the actual JIRA ID:

<meta name="ajs-issue-key" content="ANOTHERPROJECT-567">

In Java using JSoup to parse the HTML it looks like this:

// returns the actual JIRA ID or null if the JIRA ID wasn't found

String actualJiraID(String jiraId){

String url = "http://jira.atsana.com/browse/";

String username = "user";

String password = "password";

String login = username + ":" + password;

String base64login = new String(Base64.encodeBase64(login.getBytes()));

Document doc = Jsoup.connect(url+jiraId).header("Authorization", "Basic " + base64login).timeout(10000).get();

// <meta name="ajs-issue-key" content="JIRAPROJECT-123">

Element element = doc.select("meta[name=ajs-issue-key]").first();

if (null == element){

return null;

}

String issuekey = element.attributes().get("content");

return issuekey;

}

0 votes
Josh Sheldon September 3, 2013

Can you search for issues that have changed projects in the GUI? So I want to search for projects that have moved from PROJA to PROJB on the search issues screen.

Jobin Kuruvilla [Adaptavist]
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 4, 2013

JQL Tricks plugin has a movedIssues function to do this. Might help.

0 votes
Jon Sword
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 6, 2012

This should be resolved in JIRA 5.0 according to JRA-26806. Since I am still on JIRA 4.4.5 I have developed a workaround:

curl -I -sS -X GET --user username:password http://jira.example.com/browse/AKF-28522 | grep Location

If the issue has been moved you will get a Location back and it will contain the new issue key.

Suggest an answer

Log in or Sign up to answer