REST API 406 Errors
Added by Jeffrey Jones over 14 years ago
Hoi all
I am running RedMine on apache and giving the REST API a go. I tried entering issues.xml but get a 406 Not acceptable error when I used my browser.
So my next try was to use wget with the Accept header explicitly set
wget --header='Accept: application/xml' "http://x:y@server/issues/1.xml"
and still got a 406. This only happens when I request XML, everything else (html, csv etc.) works fine.
Has anyone else run into this? I have enabled the REST API option in administration and am running 0.9.2
Replies (8)
RE: REST API 406 Errors - Added by Jeffrey Jones over 14 years ago
The example ruby REST app in the wiki also fails with the same error.
RE: REST API 406 Errors - Added by Felix Schäfer over 14 years ago
curl -v -H 'Accept: application/xml'
works for me, I'm running trunk though, and Rest_api states "At the time of writing, the API is only available in trunk (see r3310, r3313)." I also just had a look at source:tags/0.9.2/app/controllers/issues_controller.rb#L106, and the respond_to
block doesn't mention an XML view, so I'd say it's not active yet in stable.
RE: REST API 406 Errors - Added by Jeffrey Jones over 14 years ago
Hoi Felix,
Thanks for the help
The problem with those "At the time of writing" comments is that I have no idea when that was written (Unless I trawl through wiki update histories) and since the revisions were done a month ago I assumed they had been merged.
I could have sworn I saw the XML method in the respond_to block when I checked the source-code in my 0.9.2 installation, my brain must be playing tricks on me or I was looking at the wrong controller maybe.
Cheers
RE: REST API 406 Errors - Added by oren golan over 14 years ago
i use 0.9.3 and try to use the ruby sample but get 401 or 406 depends on the attributes I use:
@
require 'rubygems'
require 'active_resource'
- Issue model on the client side
class Issue < ActiveResource::Base
self.site = 'http://localhost:3000'
self.user = 'admin'
self.password = 'admin'
end
- Retrieving issues
issues = Issue.find(:all)
puts issues.first@
I read somewhere that I should use the API access key.
how do i use it in the given example?
i tried self.password = <my key>
but it didn't work.
also when trying it from the browser - http://0.0.0.0:3000/issues.xml
/issues/9.xml i get 406 as well.
Thanks!
RE: REST API 406 Errors - Added by Felix Schäfer over 14 years ago
Oren, as I already pointed out above, the Issues REST API is not in 0.9.3, only in trunk.
RE: REST API 406 Errors - Added by oren golan over 14 years ago
RE: REST API 406 Errors - Added by Felix Schäfer over 14 years ago
Well, saying -b 0.9.3
gives you 0.9.3 ;-) I can't test it now and my git-foo is not that good, but git checkout master
should give you the master
branch, which is the same thing as the svn trunk. If you want to be sure, ask edavis10 on the #redmine IRC channel on freenode.
RE: REST API 406 Errors - Added by oren golan over 14 years ago
edavis10 helped and now it's working.
git's master branch is the trunk.
I switched to master and the ruby code works.
well, i had to remove the :count symbol from app/views/issues/index.xml.builder (http://www.redmine.org/issues/4745)
but after fixing it all is well.
now i'll look for put operations on issues in the docs.
Thanks!