[Solved] Export by command line
Added by Michel Z. Santello over 8 years ago
Hello,
There is a way to export a report by command line?
Regards.
Replies (4)
RE: Export by command line - Added by Djordjije Crni over 8 years ago
You can get list of issues in XML or JSON format using REST API:
http://www.redmine.org/projects/redmine/wiki/Rest_Issues
http://www.redmine.org/projects/redmine/wiki/Rest_api_with_curl
... and then transform XML to CSV using XSLT transformation.
RE: Export by command line - Added by Michel Z. Santello over 8 years ago
And using a predefined custom report , like /issues?query_id=xxx, is it possible?
Thx
RE: Export by command line - Added by Djordjije Crni over 8 years ago
You can try to make bash (or pick your favourite shell or ruby) script that will contain commands like these:
RUSERNAME=username
RPASSWORD=password
RPROJECT=projectname
cat << EOF | bundle exec rails console production
app.get "/login"
token = app.session[:_csrf_token]
app.post "/login", { :authenticity_token => token, :username => "$RUSERNAME", :password => "$RPASSWORD" }
app.get "/projects/${RPROJECT}/issues.csv?xxxxxxxxxxxxxxxxxx"
response = app.response
File.write('issues.csv',response.body)
quit
EOF
Find appropriate URI /issues.csv?xxxxxxxxxxxxxxxxxx, which correspond to /issues?query_id=xxx, by examining web server log or web browser console to view raw requests and responses.
Another solution, which can work from remote, is to use curl.
RE: Export by command line - Added by Michel Z. Santello over 8 years ago
Perfect, I will try.
Thank you.