I am trying to use REST API from a perl script. I am able to login with my credentials directly to the Jira, but getting error 501 when tried with REST API.
URL used is: https://mycompany.atlassian.net/rest/api/2/
Is there anything like REST API access has to be enabled explicitly for a particular user from the administrator? If so, how can it be done?
Hello,
You are making request to Cloud but you are using rest api for server. Moreover https://mycompany.atlassian.net/rest/api/2/ has no sense. There must something after like https://mycompany.atlassian.net/rest/api/3/project
I used https://mycompany.atlassian.net/rest/api/3/ to access Jira via a script.
my $serverurl = "https://mycompany.net/rest/api/3/";
my $username = 'my.email@domain.com';
my $password = 'my_API_token';
my $headers = {Accept => 'application/json', Authorization => 'Basic ' . encode_base64($username . ':' . $password)};
my $client = REST::Client->new();
if (!$idartinstance)
{
print " Trying to Connect to JIRA using REST client interface \n\n";
$client->GET($serverurl."serverInfo", $headers);
print $client->responseCode();
$idartinstance = decode_json($client->responseContent());
}
With this, I am getting following error:
malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "LWP will support htt...") and the response code is 501.
Could someone point where/what is wrong here?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you were using basic authentication method in your script then you should change it to either oauth or token, since Atlassian have deprecated and started to disable basic auth for security reasons:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.