Project

General

Profile

Creating Project Membership through Redmine API

Added by Justin Da Silva over 11 years ago

I get "Empty Reply" response from using the API to try to add project membership. I have no problems using the API to add Projects or Issues, but I seem to be having problems with these Project Memberships. Docs here: http://www.redmine.org/projects/redmine/wiki/Rest_Memberships

My code:

// $array['id'] is a redmine project id. In this case, it is "78" as seen in the response below
$rm_projectmembership = new Redmine_ProjectMembership($array['id'], array(
    'user_id' => (string)$me->getRedmineId(),
    'role_ids' => array('role_id' => '3')
));
$rm_projectmembership->save();

My Response:


    [request_format] => xml
    [element_name] => membership
    [extra_params] => 
    [user] => 
    [password] => 
    [element_name_plural] => memberships
    [_data] => Array
        (
            [user_id] => 8
            [role_ids] => Array
                (
                    [role_id] => 3
                )

        )

    [error] => Empty reply
    [errno] => 
    [request_body] => <?xml version="1.0" encoding="UTF-8"?><membership>
<user_id>8</user_id>
<role_ids><role_id>3</role_id>
</role_ids>
</membership>
    [request_uri] => http://localhost:81/redmine/projects/78/memberships.xml
    [request_method] => POST
    [response_code] => 403
    [response_headers] => HTTP/1.1 403 Forbidden