Question

I'm attempting to obtain a copy of Redmine's Gantt chart PNG export using curl. It seems that HTTP Basic Auth does not allow me to access it and every request made returns "HTTP/1.1 406 Not Acceptable"

curl -u <user>:<pw> -H 'Accept: image/png' -v http://redmine/projects/devprocess/issues/gantt.png

If I put the URL into a browser that is not logged into Redmine, I get the same thing (well a blank window)...so I'm assuming it has something to do with authentication. Is there a way to "login" to Redmine and maintain a consistent session via curl so that I can download this PNG file?

Note: The end solution is a Ruby script, so I'll accept Ruby answers too. Curl is just the "least common denominator" client.

Était-ce utile?

La solution

Ended up doing this in app/controllers/gantts_controller.rb:

class GanttsController < ApplicationController
   menu_item :gantt
   before_filter :find_optional_project
+  accept_api_auth :show

Seems to work. Eventually I will add it to a plugin somehow.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top