使用jira SOAP API获取jira问题的customfield值
我想使用SOAP API获取特定JIRA问题的所有自定义字段的值。我有一个名为'Phase'的自定义字段,对于JIRA问题JIRA-123具有值决策待定 我使用的是JIRA 5.1.3 我能够使用SOAP API获得JIRA问题的所有属性,但上述问题的自定义字段的值除外 我尝试了以下代码,但无法在代码中使用ComponentManager使用jira SOAP API获取jira问题的customfield值,soap,jira,Soap,Jira,我想使用SOAP API获取特定JIRA问题的所有自定义字段的值。我有一个名为'Phase'的自定义字段,对于JIRA问题JIRA-123具有值决策待定 我使用的是JIRA 5.1.3 我能够使用SOAP API获得JIRA问题的所有属性,但上述问题的自定义字段的值除外 我尝试了以下代码,但无法在代码中使用ComponentManager IssueManager issueManager = ComponentManager.getInstance().getIssueManager(); C
IssueManager issueManager = ComponentManager.getInstance().getIssueManager();
CustomFieldManager customFieldManager = ComponentManager.getInstance().getCustomFieldManager();
Issue issue = issueManager.getIssueObject("JIRA-123");
CustomField customField = customFieldManager.getCustomFieldObjectByName("Phase");
Object customFieldValue = issue.getCustomFieldValue(customField);
如果有人能提供正确的方法,我将不胜感激。我不确定如何使用soap API,下面是通过PHP-soap使用它的示例:
#!/usr/bin/php -q
<?php
$soapClient = new SoapClient("https://jira.com/rpc/soap/jirasoapservice-v2?wsdl");
$token = $soapClient->login('user', 'password');
$myIssue = $soapClient->getIssue($token,"TES-13");
print_r($myIssue); // all of the issue details
print_r($myIssue->customFieldValues); // get all custom fields
foreach ($myIssue->customFieldValues as $customFieldValue) {
// search for the right custom field
if ($customFieldValue->customfieldId == 'customfield_10402') {
echo $customFieldValue->values[0];
die();
}
}
?>
#/usr/bin/php-q
如果您想使用任何其他API,请查看
关于REST和SOAP API的一句话——引用Jira的站点,SOAP API“受支持,但没有未来的开发”。RESTAPI仍然有点新,有些事情您还不能使用RESTAPI()来完成,并且可以使用SOAP API轻松完成。5.1.3不推荐使用SOAP API。我建议您使用RESTAPI—它更易于使用和实现 什么是休息?:。基本思想是将HTTP请求类型绑定到操作,这一点很明显——检查是否快速运行 Jira有一个强大的RESTAPI,您可以使用它。这是当前版本的一部分 在一些高级步骤中需要做什么?:
- Baisc-
- 非统组织
/rest/api/2/field'[方法返回所有字段的列表][6]-包括系统字段和自定义字段。
然后,当您确定确切的字段时,使用
/rest/api/2/customFieldOption/{id}`获取自定义字段选项(在CakePHP环境中)执行此任务,结果非常好。5.1.3不推荐使用SOAP API。我建议您使用RESTAPI—它更易于使用和实现。感谢Borislav,我对RESTAPI不太熟悉。如果您可以共享一些关键指针,以便使用REST API获取JIRA问题的自定义字段值,我们将不胜感激。Thant不是这样的。。引用Jira的网站
的话,它没有被弃用,但不支持未来的开发。
。RESTAPI还是有点新,有些事情你还不能用RESTAPI来做,而且可以用SOAP API轻松地完成。谢谢Kuf,谢谢你宝贵的反馈!重要的警告。JIRA服务器API与JIRA云API不同。如果你有服务器,你就不能像Borislav在2016年11月解释的那样。