2012-08-27 180 views
1

自定義字段中有一些默認值,名爲「PLACE」,它有LONDON,PARIS等。我如何從C#中的JIRA SOAP API檢索這些(倫敦,巴黎)。 JIRA-JIRA 4.0和C# - .net framework 4.0。如何使用C#從JIRA中檢索自定義字段值?

+0

我添加一些代碼(蟒蛇,雖然它不是真的很難轉化爲C#)使用'XML-RPC' – Kuf

+0

嗨,如果這是有幫助的,請[接受其中一個答案](http://meta.stackexchange.com/questions/16721/how-does-accept-rate-work/65088#65088):) – Kuf

+0

我不認爲自定義字段的默認值是可在JIRA 4.0 SOAP API中獲得。也許在JIRA 5.x REST API中? – mdoar

回答

0

如果您未在SOAP API上設置,則可以使用XML-RPC來完成此操作。 Python代碼樣本(可以更改爲C#):

#!/usr/bin/python 

# Refer to the XML-RPC Javadoc to see what calls are available: 
# http://docs.atlassian.com/software/jira/docs/api/rpc-jira-plugin/latest/com/atlassian/jira/rpc/xmlrpc/XmlRpcService.html 

import xmlrpclib 

# Jira connction info 
#server = 'http://212.29.248.203:8080/rpc/xmlrpc' 
server = 'https://your.jira.com/rpc/xmlrpc' 
user = 'user' 
password = 'password' 
filter = '10302' 
customfieldID = "customfield_10417" 

s = xmlrpclib.ServerProxy(server) 
auth = s.jira1.login(user, password) 

# get list of issues 
issues = s.jira1.getIssuesFromFilter(auth, filter) 
for issue in issues: 
     # get open since time 
     for customFields in issue['customFieldValues']: 
       if customFields['customfieldId'] == customfieldID : 
         print "found field!"+ customFields['values'] 
相關問題