gnustavo / JIRA-REST

Thin wrapper around Jira's REST API
https://metacpan.org/release/JIRA-REST/
17 stars 17 forks source link

sample code for updating an issue to add a label #7

Closed msouth closed 7 years ago

msouth commented 7 years ago

Could you show sample code for updating an issue to add a label?

gnustavo commented 7 years ago

Hi Mike. I do it like this to add two labels to an issue:

my $jira = JIRA::REST->new('https://jira.example.net', 'user', 'password');

my $issue = $jira->PUT(
    '/issue/JJ-87',
    undef,
    {
        fields => {
            labels => ['labelA', 'labelB'],
        },
    },
);

The trick is to pass the labels inside an array.