MindTouch Developer Center > MindTouch Deki > API Reference > PUT:groups/{groupid}/users

Overview

public. Set the members for a group

Uri Parameters
NameTypeDescription
groupidstringeither an integer group ID or "=" followed by a double uri-encoded group name
Query Parameters

None

Return Codes
NameValueDescription
BadRequest400Invalid input parameter or request body
Forbidden403Administrator access is required
NotFound404Requested group could not be found
Ok200Request completed successfully

Message Format

Input:

<users>
    <user id="{int}"/>
    ...
</group>

Output:

<group id="{int}" href="{uri}">  
    <groupname>{text}</groupname>   
    <service.authentication id="{int}" href="{uri}" />   
    <users count="{int}" href="{uri}" />   
    <permissions.group>  
         <operations mask="{int}">{text}</operations>   
         <role id="{int}" href="{uri}">{text}</role>   
    </permissions.group>  
</group>

Implementation Notes

Note that this feature only updates the group user list.  Use PUT:groups/{groupid} to modify the group role. 

Code Samples

The following code example updates group with ID 2 to contain users with ID 2 and 3:

Plug p = Plug.New("http://deki-hayes/@api/deki");
p.At("users", "authenticate").WithCredentials("admin", "password").Get();
XDoc usersDoc = new XDoc("users")
    .Start("user")
        .Attr("id", 2)
    .End()
    .Start("user")
        .Attr("id", 3)
    .End();
p.At("groups", "2", "users").Put(usersDoc);

Sample response indicating that the group was successfully updated:

<group id="2" href="http://deki-hayes/@api/deki/groups/2">
    <groupname>My Contributors Group</groupname> 
    <service.authentication id="1" href="http://deki-hayes/@api/deki/site/services/1" /> 
    <users count="2" href="http://deki-hayes/@api/deki/groups/2/users" /> 
    <permissions.group>
        <operations mask="1343">LOGIN,BROWSE,READ,SUBSCRIBE,UPDATE,CREATE,DELETE,CHANGEPERMISSIONS</operations> 
        <role id="4" href="http://deki-hayes/@api/deki/site/roles/4">Contributor</role> 
    </permissions.group>
</group>
Tag page
You must login to post a comment.
Powered by MindTouch Deki v.8.08.1