Project

General

Profile

API authentication and content type

Added by José Moreira over 14 years ago

I've been trying to make use of the API to import Projects into our Redmine installation and have been dealing with the following:

A. when 'Require authentication' in on, i can't authenticate against Redmine using HTTP Basic Auth

B. when 'Require authentication' in off, i get a "HTTP/1.1 406 Not Acceptable" response.

My PHP code is:

require_once ('ActiveResource.php');

class Project extends ActiveResource {
    var $site = 'http://***:***@****/';
    var $request_format = 'xml'; // REQUIRED!
}

$projects = new Project ();
$projects = $projects->find ('all');
print_r($projects);

Response:

Processing ProjectsController#index to xml (for 85.242.69.190 at 2010-03-03 13:15:54) [GET]
  Parameters: {"format"=>"xml", "action"=>"index", "controller"=>"projects"}
Completed in 8ms (View: 1, DB: 0) | 406 Not Acceptable [http://***/projects.xml]

My setup is:

- Redmine 0.9.3.stable.3521
- ruby 1.8.7 (2009-06-12 patchlevel 174


Replies (2)

RE: API authentication and content type - Added by José Moreira over 14 years ago

The rest of the deps:

Ruby version 1.8.7 (x86_64-linux)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.5
Active Record version 2.3.5
Active Resource version 2.3.5
Action Mailer version 2.3.5
Active Support version 2.3.5
Application root /usr/local/redmine
Environment production
Database adapter mysql
Database schema version 20100221100219

RE: API authentication and content type - Added by Felix Schäfer over 14 years ago

Rest_api states At the time of writing, the API is only available in trunk (see r3310, r3313), so you won't have any chance to make it work with the current stable, sorry.

    (1-2/2)