in reply to JIRA-Client-Automated stopped working for me, Atlassian modified the API's. The requested API for searching issues has been removed.

A possible brute force solution, because it turns out you only have to add "jql/" to the $uri. You better also remove startAt because of https://community.atlassian.com/forums/Jira-questions/POST-rest-api-3-search-jql-returns-400-quot-Invalid-request/qaq-p/3111234.

Oh, and by the way, search_accountId works differently. I logged https://rt.cpan.org/Public/Bug/Display.html?id=131856 for this. JIRA-Client-Automated is without a maintainer it seems.

#!/usr/bin/perl 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}; } sub search_issues { my ($self, $jql, $start, $max, $fields) = @_; $fields ||= ['*navigable']; my $query = { jql => $jql, # startAt => $start, # https://community.atlassian.c +om/forums/Jira-questions/POST-rest-api-3-search-jql-returns-400-quot- +Invalid-request/qaq-p/3111234 maxResults => $max, fields => $fields, }; my $query_json = $self->{_json}->encode($query); my $uri = "$self->{auth_url}search/jql/"; my $request = POST $uri, Content_Type => 'application/json', Content => $query_json; my $response = $self->_perform_request($request, { 400 => sub { # pass-thru 400 responses for us to deal with bel +ow my ($response, $request, $self) = @_; return $response; }, }); if ($response->code == 400) { my $error_msg = $self->{_json}->decode($response->decoded_cont +ent()); return { total => 0, errors => $error_msg->{errorMessages} }; } my $results = $self->{_json}->decode($response->decoded_content()) +; return { total => $$results{total}, start => $$results{startAt}, max => $$results{maxResults}, issues => $$results{issues} }; } package main; ...

Greetings, I hope someone might find this useful,

Thanks,

Johan

--
if ( 1 ) { $postman->ring() for (1..2); }
  • Comment on Re: JIRA-Client-Automated stopped working for me, Atlassian modified the API's. The requested API for searching issues has been removed.
  • Download Code