Rest Memberships » History » Revision 1
Revision 1/8
| Next »
Jean-Philippe Lang, 2012-02-06 11:40
Project Memberships¶
- Table of contents
- Project Memberships
/projects/:project_id/memberships.:format¶
GET¶
Returns a paginated list of the project memberships. :project_id
can be either the project numerical id or the project identifier.
Examples:
GET /projects/1/memberships.xml GET /projects/redmine/memberships.xml
Response:
<?xml version="1.0" encoding="UTF-8"?> <memberships type="array" limit="25" offset="0" total_count="2"> <membership> <id>1</id> <project name="Redmine" id="1"/> <user name="David Robert" id="17"/> <roles type="array"> <role name="Manager" id="1"/> </roles> </membership> <membership> <id>3</id> <project name="Redmine" id="1"/> <group name="Contributors" id="24"/> <roles type="array"> <role name="Contributor" id="3"/> </roles> </membership> <membership> <id>4</id> <project name="Redmine" id="1"/> <user name="John Smith" id="27"/> <roles type="array"> <role name="Developer" id="2" /> <role name="Contributor" id="3" inherited="true" /> </roles> </membership> </memberships>
In the above example, the inherited="true"
attribute on the last role means that this role was inherited from a group (eg. Jonh Smith belongs to the Contributors group and this group was added as a project member). John Smith's membership can not be deleted without deleting the group membership first.
POST¶
Adds a project member.
Parameters:
membership
(required): a hash of the membership attributes, including:user_id
(required): the numerical id of the userrole_ids
(required): an array of roles numerical ids
Response:
201 Created
: membership was created422 Unprocessable Entity
: membership was not created due to validation failures (response body contains the error messages)
/memberships/:id.:format¶
GET¶
Returns the membership of given :id
.
Examples:
GET /memberships/1.xml
Response:
<?xml version="1.0" encoding="UTF-8"?> <membership> <id>1</id> <project name="Redmine" id="1"/> <user name="David Robert" id="17"/> <roles type="array"> <role name="Developer" id="2"/> <role name="Manager" id="1"/> </roles> </membership>
PUT¶
Updates the membership of given :id. Only the roles can be updated, the project and the user of a membership are read-only.
Parameters:
membership
(required): a hash of the membership attributes, including:role_ids
(required): an array of roles numerical ids
Response:
200 OK
: membership was updated422 Unprocessable Entity
: membership was not updated due to validation failures (response body contains the error messages)
DELETE¶
Deletes a memberships.
Memberships inherited from a group membership can not be deleted. You must delete the group membership.
Parameters:
none
Response:
200 OK
: membership was deleted422 Unprocessable Entity
: membership was not deleted
Updated by Jean-Philippe Lang over 12 years ago · 1 revisions