How to export to HTML from Search Results from command line (need authentication)

Zlatko Kajan April 18, 2019

Hello,

If I go into Issues>Search for Issues, type in my JQL, then click Export>HTML(Current Fields) it makes a nice html web page.  If I hover over HTML(Current Fields) it gives me the following URL:

 

<local jira URL>/sr/jira.issueviews:searchrequest-html-current-fields/temp/SearchRequest.html?jqlQuery=project+=+<projectname>+AND+fixVersion+=+<version>+ORDER+BY+key+ASC&tempMax=1000

 

When i go on command line and do 

wget <local jira URL>/sr/jira.issueviews:searchrequest-html-current-fields/temp/SearchRequest.html?jqlQuery=project+=+<projectname>+AND+fixVersion+=+<version>+ORDER+BY+key+ASC&tempMax=1000 > saveJIRA.html 

it returns with a 400 error.  I am guessing this is because I did not include authentication information and our JIRA and the project itself are locked by user groups.

 

So I tried 

wget <local jira URL>/sr/jira.issueviews:searchrequest-html-current-fields/temp/SearchRequest.html?os_username-<myusername>&os_password=<mypassword>&jqlQuery=project+=+<projectname>+AND+fixVersion+=+<version>+ORDER+BY+key+ASC&tempMax=1000 > saveJIRA.html 

 

And that generated two files. saveJIRA.html which is blank, and SearchRequest.html|?os_username=<myusername> which actually looks kind of like the page I was expecting except it says displaying 0 issues and there are no issues listed.

 

So what am I missing here?

1 answer

1 accepted

1 vote
Answer accepted
Earl McCutcheon
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 23, 2019

Hi Zlatko,

I am using a mac to test this out and By default, there is no wget on Mac OS, so I was using the equivalent of Linux’s wget which is curl -O and getting similar results to what you were seeing.

I was not able to get this working with wget equivelent curl -O, However doing a curl -X with a basic GET on the endpoint was working great using this format:

curl -u username:password -X GET http://BASE_URL/sr/jira.issueviews:searchrequest-html-current-fields/temp/SearchRequest.html?jqlQuery=project+%3D+ASDF+AND+fixVersion+%3D+1.0+ORDER+BY+key+ASC > test.html

I would recommend trying out curl instead and on windows you can get curl installed from the open source project https://curl.haxx.se/windows/

Regards,
Earl

Zlatko Kajan April 30, 2019

Thank you @Earl McCutcheon , for some reason I thought curl could only be used with the JSON implementation and REST, but no, that turned out to be the right thing.  Was able to build a grade script that detects if build running in GUI or not (don't want it happening during Bamboo builds), asks for username/pw, passes it on to curl command which generates the page in question and embeds it in the "offline" delivery folder so users can see which tickets were fixed when on systems that are not physically able to see JIRA.

Like Earl McCutcheon likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events