How does an external system authenticate to get XML filter results?

mike.howells September 14, 2011

I have a PHP mash-up that needs to get all the issues in a version with the issue links included. The SOAP API doesn't include issue links in the RemoteIssue objects, but the XML result for a filter does. Trouble is you have to be logged in to do a JQL query.

So how does my PHP code login to JIRA so that it can get the XML result for a JQL query in order to get the issue links?

4 answers

1 accepted

1 vote
Answer accepted
Igor Sereda [ALM Works]
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.
September 14, 2011

Alternatively, you can include os_username and os_password as the URL parameters with your request and forget about JSESSIONID:

http://example.com/jira/sr/jira.issueviews:searchrequest-xml/temp/SearchRequest.xml?tempMax=1000&jqlQuery=project%3DXYZ+and+fixversion%3D%221.7.0%22&os_username=login&os_password=password

mike.howells September 14, 2011

Thanks, works a treat!

Is that mechanism documented anywhere? Can't find any reference to os_username in the official documentation.

0 votes
Igor Sereda [ALM Works]
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.
September 14, 2011

You need to send a valid JSESSIONID cookie with your request, which you should get when logging in.

To log in, you can use $jiraUrlBase/rest/gadget/1.0/login URL and pass os_username, os_password as form parameters and also os_cookie=true. Pass also "Accept: application/json" header and analyze the json that you get in response to see if the login was successful. JSESSIONID will be passed in Set-Cookie from the server.

0 votes
mike.howells September 14, 2011

The REST API does provide issue links, but doesn't provide a list of all issues in a fix version. I've tried using POST auth/1/session to authenticate and then using the above XML filter query, but no joy.

0 votes
mike.howells September 14, 2011

Suggest an answer

Log in or Sign up to answer