2012-08-08 250 views
1

JIRA SOAP API是否允許我鏈接不同項目中的兩個問題?我在網上查找並沒有找到一種方法來做到這一點。我見過的最接近的是createIssueWithParent方法,它創建了子組織(我想要連接兩個問題,而不是子組織),這需要問題在同一個項目中(也不是我想要的)。不同項目中Jira問題之間的鏈接

有誰知道一種方法來做到這一點?

+0

我終於得到了使用REST的這個工作,但我只能創建類型爲「Duplicate」的問題鏈接。我想創建「與...有關」的鏈接,但是將我的類型設置爲諸如「與...有關」和「涉及到」之類的各種東西都不起作用。有誰知道鏈接類型是有效的? – 2012-08-15 22:45:15

+0

事實證明,「相關」是我一直在尋找的。 – 2012-08-15 22:57:51

回答

0

在SOAP沒有簡單的方法,但我已經使用REST方法和JIRA 4.4,如這樣做

# 
# Add links to JIRA issues 
# 
# Matt Doar 
# CustomWare 
# 
# usage: create_links.sh issue_id issue_key 
# where the issue_id is the unique id for a JIRA issue, not it's issue key. 
# You can see the issue id in the XML view of an issue. 
# and issue_key is the other issue to be linked to. 

USERNAME=admin 
PASSWORD=secret 
SERVER_URL="http://localhost:8080" 

DASHBOARD_PAGE_URL=$SERVER_URL/secure/Dashboard.jspa 
COOKIE_FILE_LOCATION=jiracoookie 

# Get the authentication cookie 
curl -u $USERNAME:$PASSWORD --cookie-jar $COOKIE_FILE_LOCATION -sS --output /dev/null $DASHBOARD_PAGE_URL 

issueid=$1 
issuekey=$2 
#echo "Linking issue: $issueid and $issuekey" 
curl --cookie $COOKIE_FILE_LOCATION --header "X-Atlassian-Token: no-check" -sS --output /dev/null -d "id=$issueid" -d "linkDesc=relates to" -d "linkKey=$issuekey" "$SERVER_URL/secure/LinkExistingIssue.jspa" 

rm -f $COOKIE_FILE_LOCATION 
+0

在stackoverflow上的代碼宏是真的令人沮喪 – mdoar 2012-08-08 22:15:06

0

I don't think that linking is possible通過SOAP API。我做這個使用XML-RPC API,與createIssueLink功能:

from com.atlassian.jira import ComponentManager 
# get issue objects 
authenticationContext = ComponentManager.getInstance().getJiraAuthenticationContext() 
issueLinkManager = ComponentManager.getInstance().getIssueLinkManager() 
# Link parent issue to subtask 
issueLinkManager.createIssueLink(issue.getId(),otherIssue.getId(),10003,1,authenticationContext.getUser())