Can I check the results of an issue generated by the JIRA :: REST Module in a Perl environment?

Hi, everyone.
I created an issue using the JIRA :: REST module in the perl environment as shown below.

use utf8;
use Filehandle;
use strict;
use warnings;
use Encode;
use JIRA::REST;

my $jira = JIRA::REST → new({
url => ‘http://company.domain:8080’,
username => ‘xxxxx’,
password => ‘xxxxxxxxxx’,
});

print FILE_H “jira: “.$jira.” \n\n” ;

my $issue = $jira → POST(‘/issue’, undef, {
fields => {
project => {key => ‘SMPKB’},
issuetype => {name => ‘Task’},
summary => ‘JIRA-REST, summary.’,
description => ‘bla bla bla.’,
},
});

I also checked the issue created by logging into Atlassian Jira.
How do I check the return value of an issue generated without logging into Atlassian Jira?
I need to be able to check in a Perl environment.

Alex

Hello Alex,

Since Create issue REST API returns a JSON response body, you can check it out by calling something like

print Dumper($issue);

or check if the $issue->{key} exists, which might tell you that an issue has been successfully created. Usually, the HTTP status is checked but I am not sure how it will be done with JIRA::REST module.

Cheers,
Ian

1 Like

Hi, Ian
I sincerely appreciate your help.
I solved it because of your help.
The source is shown below.

use utf8;
use Filehandle;
use strict;
use warnings;
use Encode;
use JIRA::REST;
use REST::Client;
use JSON;
use Data::Dumper;
use MIME::Base64;

y $jira = JIRA::REST → new({
url => ‘http://company.domain:8080’,
username => ‘xxxx’,
password => ‘xxxx’,
});

my $issue = $jira → GET(“/issue/SMPKB-16?fields=summary,description”);
my $fields = $issue->{fields};
print “summary = $fields->{summary}\n”;
print “description = $fields->{description}\n”;

The results below.
Active code page: 65001
F:\ideaic\perl\site\lib>perl ideaic_interface_jira_get.pl
summary = Issues like this one that are marked as fixed in a released version do not show up in Work mode but are included in the reports
Wide character in print at ideaic_interface_jira_get.pl line 65.
description = 한글 테스트.

F:\ideaic\perl\site\lib>

However, a “wide character in print at” error occurs.
I’ve added the code below, but I get an error.
binmode OUT, ‘:encoding($fields)’;

Cheers,
Alex

Hello @netdynamics, for “wide character in print at” warning, one of the solutions is to use the -CS parameter mentioned in this post; I tried it out and it works. There are also perl unicode related documentation in here.

I see that you were able to incorporate the answer in I want to print only specific field values of a specific issue - #3 by netdynamics. If that works for you kindly mark the solution to that question so that others who are facing the same issue can find the solution.

Hope this helps.
Ian