Hi, team.
In the Perl environment, I want to update the custom field value of a specific issue using the JIRA REST API.
1 CASE:
my $issue_progress = $jira -> POST("/issue/".$row[12]."");
fields => {
customfield_10221 => $vprogress
};
2 CASE:
my $issue = $jira -> POST('/issue', undef, {
fields => {
issue => {id => $row[12]},
customfield_10221 => $vprogress
},
});
3 CASE:
my $issue_progress = $jira->POST('/rest/api/2/issue/'.$row[12], undef, {
fields => {
customfield_10221 => $vprogress
}});
'$ row [12]' is the Issue id.
I have tested all three methods above. However, errors occur.
I saw https://docs.atlassian.com/software/jira/docs/api/REST/8.0.0/#api/2/issue-editIssue. But I do not know.
Waiting for help from experts.
thank you.
alex.
Hi, Gonchik
I solved it. I modified the source as shown below.
my $issue_progress = $jira->PUT('/rest/api/2/issue/'.$row[12]., undef, { fields => { customfield_10221 => $vissue_progress }});print "The '".$row[12]."' issue progress has been updated successfully. \n";
Thank you.
Alex.
Hi!
Do you use Jira 8.0.0 ?
And could you provide some errors here ?
I use it like that in python
Cheers,
Gonchik Tsymzhitov
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, Gonchik
We are using jira 7.12.3
I did not get any special errors, so I used eval {}. (below)
eval {
my $issue = $jira -> GET("/issue/".$row[12]."");
print "The issue key '".$row[12]."' exist.(in Jira) \n";
# 2. Gets the status of the Jira issue key that matches the issue key.(below)
my $fields = $issue->{fields};
my $status = $fields->{status};
my $vStatus = $status->{id};
my $assignee = $fields->{assignee};
my $vProgress = $fields->{progress};
my $vissue_progress;
if (defined $vProgress->{percent}) {
print "Message(1): progress.percent = $vProgress->{percent}% \n";
$vissue_progress = $vProgress->{percent};
} else {
print "Message(1): progress.percent field has not value.(in Jira) \n";
}
# 3. status is 10000. 'To Do' does not get the field value of 'Jira'.(below)
if ($vStatus eq '10000') {
print "break point : status is 10000. 'To Do' does not get the field value of 'Jira'. \n";
# 4. status is 3. 'In Progress' does get the field value of 'Jira'.
# 5. status is 10001. 'Done' does last get the field value of 'Jira'.
} else {
print "break point : status is 3 or 10001'. \n";
# my $issue_progress = $jira -> POST("/issue/".$row[12]."");
# fields => {
# customfield_10221 => $vprogress
# };
# my $issue = $jira -> POST('/issue', undef, {
# fields => {
# issue => {id => $row[12]},
# customfield_10221 => $vprogress
# },
# });
my $issue_progress = $jira->POST('/rest/api/2/issue/'.$row[12].'editmeta', undef, {
fields => {
customfield_10221 => $vissue_progress
}});
print Dumper($issue_progress);
print "The progress has been updated successfully. \n";
}
};
if ($@) {
print "Message(1): The issue key '".$row[12]."' does not exist.(in Jira) \n";
}
I understood what you mean by the Python code you gave me.
However, it can not be converted to Perl.
I need help with Perl code.
thank you.
alex.
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.