Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Can't get the REST API to work

Peter Adamsen October 31, 2023

Hello,

 

We have a self-hosted JIRA installation. (wbl*******.weibel.dk)

I am making a simple C++ application to receive some JIRA statistics using the REST API interface.

I have created an API Token and BASE64 encoded it with my email according the the guide on: Basic auth for REST APIs (atlassian.com).

I am testing with something close to the example on the same page. (Reading a ticket)

See my HTTP request dump from Wireshark below: (Credentials look fine)

But, I keep getting the response: 

{"errorMessages":["You do not have the permission to see the specified issue.","Login Required"],"errors":{}}

(Same message if I change something in the Credentials.)

On my profile, "Personal Access Tokens" page my "Last Authenticated" display: Never.

(Everything works fine using normal JIRA WEB interface)

 

Can anything be blocking access ? - Can the REST API be disabled ? - How to find out ?

Thank you for any help.

 

 

 

Hypertext Transfer Protocol
GET https://wbl*********.weibel.dk/rest/api/latest/issue/RAST2INT-4\r\n
[Expert Info (Chat/Sequence): GET https://wbl***.weibel.dk/rest/api/latest/issue/RAST2INT-4\r\n]
[GET https://wbl*****.weibel.dk/rest/api/latest/issue/RAST2INT-4\r\n]
[Severity level: Chat]
[Group: Sequence]
Request Method: GET
Request URI: https://wbl*****.weibel.dk/rest/api/latest/issue/RAST2INT-4
Request Version:
Authorization: Basic cGFAd2VpYmVsLm****Q21DNGhTWGpqdGRC\r\n
Credentials: pa@weibel.dk:OTMxMT*****hSXjjtdB
Content-Type: application/json\r\n
\r\n
[HTTP request 1/1]

0030 02 00 fa 9c 00 00 47 45 54 20 68 74 74 70 73 3a ......GET https:
0040 2f 2f 77 62 6c                                                        //wbl*****
0050 2e 77 65 69 62 65 6c 2e 64 6b 2f 72 65 73 74 2f .weibel.dk/rest/
0060 61 70 69 2f 6c 61 74 65 73 74 2f 69 73 73 75 65 api/latest/issue
0070 2f 52 41 53 54 32 49 4e 54 2d 34 0d 0a 41 75 74 /RAST2INT-4..Aut
0080 68 6f 72 69 7a 61 74 69 6f 6e 3a 20 42 61 73 69 horization: Basi
0090 63 20 63 47 46 41 64 32 56 70 59 6d 56 73 4c 6d c cGFAd2VpYmVsLm
******
00d0 31 44 4e 47 68 54 57 47 70 71 64 47 52 43 0d 0a 1DNGhTWGpqdGRC..
00e0 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 Content-Type: ap
00f0 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 0d 0a plication/json..
0100 0d 0a ..

2 answers

1 accepted

1 vote
Answer accepted
Peter Adamsen November 1, 2023

I solved the problem.

Following seems to be mandatory in the HTTP request:

 

Request version: HTTP/1.1

Host: wb.......weibel.dk

 

And credentials must be: Username and password BASE64 encoded.

Samip Tripathy November 1, 2023

Hi Peter,

I am also facing the exact similar problem. But I did not quite understood your solution. Can you please be a little more elaborate. 
I am doing the same but in python to get some jira statistics using rest API. And i have also tried base64 encoding. But the error is still there

Peter Adamsen November 3, 2023

The way I succeeded was to compare in WireShark between the HTTP message I sent from my own software compared the the HTTP message that was sent by the DOS Shell CURL command in the example on Basic authentication (atlassian.com).

If you to post your exact HTTP packet from a WireShark dump, I can take a look .....

Samip Tripathy November 6, 2023

Thanks Peter! I was able to solve the problem by following a similar approach

Like Peter Adamsen likes this
0 votes
Peter Adamsen November 1, 2023

For the Auhorization: Basic credentials, I have tried all combinations of User/Username/Email:ApiToken/password I can think of, but the result is exactly the same each time.

Raechel C_ November 2, 2023

I am having the same issue. I can do a simple request with powershell, but when i try to use postman, no luck. all i get back is:

{
    "errorMessages": [
        "You do not have the permission to see the specified issue.",
        "Login Required"
    ],
    "errors": {}
}
and I have:
1. Created my token in jira profile
2. Encoded it with my email:token
3. added it as a header in postman (tried several different header types)
I can access fine via powershell with: 
headers = @{
 Authorization = $bearerAuthValue
}
try 
{
    $results = Invoke-WebRequest -Uri $url -Headers $headers
but not with postman. Has anyone figured out how to log into jira and make calls to get jira info with postman?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events