Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to add component while creating an issue via JIRA REST API using perl

kaushik karnatakam
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 20, 2018

 

In my perl script,

$finalstr value am getting as [{name => 'SIP'},{name => 'Platform'}], however this is not getting substituted in the REST API. But if i pass the same value as hard-coded it is executing successfully.


my $jira = JIRA::REST->new({
url => 'https://ecample.com',
username => 'XXXXXXXXX',
password => 'XXXXX',
});

# File a bug
my $issue = $jira->POST('/issue', undef, {
fields => array{
project => { key => 'XXX' },
issuetype => { name => 'Bug' },
summary => '10-8-2018 tessdatsad32 checking field persent or not',
description => 'test',
versions => [{name => $Affected_version}],
customfield_10100 => $Affected_Build_Number,
priority => {name =>'(3) Minor'},
customfield_10035 => {value =>'Always'},
components => $finalstr,
customfield_10028 => {value =>'GA'},
customfield_11296 => {value =>'Yes'},
#attachment => {value => other-jira-error.pl}
#attach_files => {'other-jira-error.pl'},
},
});

# Iterate on issues
my $search = $jira->POST('/search', undef, {
jql => 'project = sdfs AND issuetype = Bug AND status = Unassigned AND created >= -10m',
startAt => 0,
maxResults => 1,
fields => [ qw/summary status assignee/ ],
});

foreach my $issue (@{$search->{issues}}) {
print "Found issue $issue->{key}\n";
}

 Please help.

0 answers

Suggest an answer

Log in or Sign up to answer