在不同项目中链接Jira问题

时间:2012-08-08 00:38:51

标签: c# api soap jira

JIRA SOAP API是否允许我链接不同项目中的两个问题?我已经在线查看,但没有找到办法。我所看到的最接近的是createIssueWithParent方法,它创建了子句(我想要链接两个问题,而不是子问题),这需要问题在同一个项目中(也不是我想要的)。

有谁知道这样做的方法?

2 个答案:

答案 0 :(得分:0)

I don't think that linking is possible通过SOAP API。我使用XML-RPC APIcreateIssueLink函数完成了此操作:

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())

答案 1 :(得分:0)

在SOAP中没有简单的方法,但我使用RESTful方法和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