【发布时间】:2018-07-20 07:02:44
【问题描述】:
我们无法通过 Perl 脚本使用 REST-API 在 Jira 中创建新票证。
注意:没有成功执行自定义字段脚本。请提供在我的脚本中添加自定义字段的建议。
自定义字段的屏幕截图。
错误信息:
JIRA::REST 错误[400 - 错误请求]: - [custom_field] 无法设置字段“custom_field”。它不在相应的屏幕上,或者在 copy_of_new-jira.pl 第 16 行上的 unknown.
Perl 脚本:
#Loading the modules from a specific location such that JIRA::REST.
use JIRA::Client::Automated;
use JIRA::REST;
use Data::Dumper;
#Login details about Jira server
my $jira = JIRA::REST->new({
url => 'https://xxxxxxxx.xxxxx.com',
username => 'xxxxxxx',
password => 'xxxxxxx',
});
# Create the ticket using post function
my $issue = $jira->POST('/issue', undef, {
fields => {
project => { key => 'TIME' },
issuetype => { name => 'Task' },
summary => '20-7-2018 checking field persent or not',
description => 'test',
custom_field => { Epic Link => 'Application Framework'},
},
});
【问题讨论】:
-
你试过
custom_field => { 'Epic Link' => 'Application Framework' }吗? -
您似乎不应该将自定义字段放入具有自己的哈希引用及其显示名称的
custom_field键中。相反,直接在fields哈希中使用字段的内部名称。我不记得命名方案,但这些字段的名称中有很多数字。 -
感谢您的支持。现在它工作正常。添加到字段后 => { 项目 => { key => 'TIME' },issuetype => { name => 'Task'},summary => '20-7-2018 检查字段是否存在',描述 => 'test', customfield_11197 => 'VIGIL-217' },
标签: perl perl-module jira-rest-api