Hi, Team.
To get a specific issue for a particular Jira project, I wrote the following Perl script:
-----------------------------
use utf8;
use Filehandle;
use strict;
use warnings;
use Encode;
use JIRA::REST;
use REST::Client;
use JSON;
use Data::Dumper;
use MIME::Base64;
my $jira = JIRA::REST -> new({
url => 'http://company.domaiin:8080',
username => 'xxxx',
password => 'xxxxxxxx',
});
# Get issue.
my $issue = $jira -> GET("/issue/SMPKB-16");
my $json_text = do {
open(my $json_fh, "<:encoding(UTF-8)", $issue) or die ("Can't open \$issue\": $!\n");
local $/;
<$json_fh>
};
my $json = JSON -> new;
my $data = $json -> decode($json_text);
-----------------------------
However, I can not 'print' the summary and description fields of a particular issue.
I added a JSON script, but I still get an error (I use JSON for the first time).
I look forward to your help.
Alex.
We solved it by following method.
my $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.
So I changed the Perl parameter as shown below.
Active code page: 65001
F:\ideaic\perl\site\lib>perl -CS 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
description = 한글 테스트.
F:\ideaic\perl\site\lib>
Thank you very much.
Hi @alex seol,
it might be that you're getting better results when you post this question on the Atlassian Developer community.
But I'll try to give you an answer nevertheless. It looks like you're calling the endpoint: http://company.domaiin:8080/issue/SMPKB-16, but you should call http://company.domaiin:8080/rest/api/2/issue/SMPKB-16 instead.
Checkout the REST API docs about get issue.
Cheers,
Matthias.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Matthias.
Thank you for your explanation.
The reason I used "http: //company.domainin: 8080 / issue / SMPKB-16" is because I use the "JIRA :: REST" module (see previous mail).
If I want to use the JIRA REST API directly without using the "JIRA :: REST" module (Perl), what do I need to "USE" in a Perl environment?
You can not understand because there is no sample at https://docs.atlassian.com/software/jira/docs/api/REST/8.0.0/#api/2/issue-getIssue.
And using http: //company.domainin: 8080 / rest / api / 2 / issue / SMPKB-16, the following error occurs.
Cheers,
Alex
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I see, thank you for your explanations and actually showing the error message. I'm afraid I cannot help here. As I stated earlier, please head over to the Atlassian Developer Community. More people might be able to help you there.
Or maybe someone else jumps in :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.