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

Problems getting versions from JIRA using REST API

John Byerly April 1, 2013

I am trying to access JIRA (5.2.6) via an application. I am sending a request to get the versions in our project, but I am getting a 404 error (not found) in return. I installed the REST API browser and was able to test my syntax there. Here is where it gets weird (for me):

If I issue the GET command in a Google Chrome browser, I get the expected results. If I issue the same exact command in Internet Explorer, I get a 404 error. Not that I want to do any of this from a browser, but I was testing the command.

(For the record, here is what I was sending: http://mydomain.com:8080/rest/api/2/project/CNC/versions)

I even checked the data going over the network with Wireshark to see if there were any differences between the command from my application and the one from Chrome. As far as I could tell, the only difference was the use of cookies.

We are trying to automate our build and release processes and would like to get the version information from JIRA (and maybe a few other things as well).

Thanks for any help!

JAB

3 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
John Byerly April 2, 2013

It appears that the authentication was missing. Unfortunately, the error 404 (not found) returned by the server did not help to determine the problem.

Using Tiago's suggestion, I issued a curl from a Windows command prompt and watched it with Wireshark. I compared this with the request I sent from my application. The only notable difference was the authentication. Since the server does not demand authentication, I could not use the .NET class (HttpWebRequest) to supply it, so I had to add it to the request header manually. Once I did this, it all worked fine.

This blog entry was helpful for adding the authentication to the request:

http://blog.kowalczyk.info/article/at3/Forcing-basic-http-authentication-for-HttpWebReq.html

JAB

2 votes
Tiago Comasseto
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2013

Hi John,

Judging by your description, it seems a problem not in JIRA itself, because in Chrome it returns the expected result. If it was an issue with JIRA, it would not work anywhere.

Is there any proxy in front of JIRA or configured in the browser? Also, you mentioned that the difference you saw with Wireshark was the use of cookies. I believe you are seeing the cookies in your browser, if so, it's okay as it's the expected browser behavior.

Do you receive the correct responce running it on CURL for example?

curl -u user:password http://mydomain.com:8080/rest/api/2/project/CNC/versions

Just for reference, a valid responce would be something like this:

[{"self":"http://localhost:8090/jira/rest/api/2/version/10001","id":"10001","description":"test2","name":"2","archived":false,"released":false,"releaseDate":"2013-04-01","overdue":true,"userReleaseDate":"01/Apr/13"},{"self":"http://localhost:8090/jira/rest/api/2/version/10000","id":"10000","description":"test1","name":"1","archived":false,"released":false,"releaseDate":"2013-04-01","overdue":true,"userReleaseDate":"01/Apr/13"},{"self":"http://localhost:8090/jira/rest/api/2/version/10003","id":"10003","description":"test4","name":"4","archived":false,"released":false,"releaseDate":"2013-04-01","overdue":true,"userReleaseDate":"01/Apr/13"},{"self":"http://localhost:8090/jira/rest/api/2/version/10002","id":"10002","description":"test2","name":"3","archived":false,"released":false,"releaseDate":"2013-04-01","overdue":true,"userReleaseDate":"01/Apr/13"}]

Cheers

0 votes
Arun_Thundyill_Saseendran
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 11, 2014

Hi

The reason why you are getting the response in chrome and not is IE is because, you may be usually logging in with chrome hence the chome browser has all the cookies set for authentication. Hence it is authorized to get the contents. Whereas in IE, since there are no cookies set, you aren't able to get the versions data. When it is from you application, to authenticate, set a header as "Authorization" and the value of it should be

"Authorization" and the value of it should be "Basic<space><(username:password) encoded in base64>"

This will solve the issue. Thanks Arun

TAGS
AUG Leaders

Atlassian Community Events