Arathi Gopinath
Arathi Gopinath

Reputation: 9

Wget to download excel from Jira automatically

I have tried the below commands to get the excel file automatically from jira but I'm getting different data other than the filter data.

wget --user username--password pass -O test.xls --ignore-length=on http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000;

curl -D my-output.xml -u upgrade:hjjKl801 -X GET -H "Content-Type: application/json" http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000

Please help me here.

Upvotes: 0

Views: 3130

Answers (3)

Alessandro Gastaldi
Alessandro Gastaldi

Reputation: 1

You must use -O flag as:

curl -o excel.xls -O -u upgrade:hjjKl801 -X GET -H "Content-Type: application/json" http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000

Upvotes: 0

Thierry Dalon
Thierry Dalon

Reputation: 926

I can't get Wget work in my environment (permission denied error; maybe because of SSO?) but following curl command .

"D:\DSUsers\uid41890\Tools\curl.exe" -o C:\Users\uid41890\Documents\JIRA\search.csv -u uid41890:password -X GET "http://jiraurl:port/sr/jira.issueviews:searchrequest-csv-current-fields/17899/SearchRequest-17899.csv"

No need for Header options as mentioned in @grundic's answer.

Replace -D by -o in your original command and change the output file format from xml to csv for example.

Upvotes: 0

grundic
grundic

Reputation: 4921

You have to set correct encoding header gzip :

curl -D my-output.xml -u upgrade:secret -X GET -H "Content-Type: application/json" -H "Accept-Encoding: gzip" "http://esjirq62.emea.nsn-net.net:8080/sr/jira.issueviews:searchrequest-excel-all-fields/70920/SearchRequest-70920.xls?tempMax=1000"

Some notes:

  • Remove password from your example
  • -D flag for curl dumps headers, not output. Did you mean -o maybe?
  • Content-Type header can be skipped
  • To be on the safe side, put the url in double quotes
  • You can copy request from Google Chrome using developer tools

Upvotes: 1

Related Questions