Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assign_issue doesn't work anymore #20

Open
gargle opened this issue Apr 15, 2020 · 0 comments
Open

assign_issue doesn't work anymore #20

gargle opened this issue Apr 15, 2020 · 0 comments

Comments

@gargle
Copy link

gargle commented Apr 15, 2020

See https://rt.cpan.org/Public/Bug/Display.html?id=131856 where I logged this issue.

The problem is, personal data that is used to identify users, such as the username and userKey, got removed from the REST APIs. Users are identified by their Atlassian account ID (accountId)
instead. See https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/.

Instead of using assign_issue I do this instead

$jira->update_issue( $issue->{key}, { "assignee" =>
{ 'accountId' =>
$jira->search_accountId($bpostcentraluser) }});

for this to work, I extended your package with a search_accountId method:

use JIRA::Client::Automated;
package JIRA::Client::Automated;
sub search_accountId {
my ($self, $emailAddress) = @_;
my $uri = $self->{auth_url} .
'user/search?query=' . $emailAddress . '&fields=accountId';
my $request = GET $uri, Content_Type => 'application/json';
my $response = $self->_perform_request($request);
my $results = $self->{_json}->decode($response->decoded_content());
my $data_ref = @{$results}[0];
die "something went wrong while searching for $emailAddress"
if ($data_ref->{emailAddress} ne $emailAddress);
return $data_ref->{accountId};
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant