API - Create Group By Path

Create Group By Path

This API is used to create a sub group by specifying the path to the parent group.

Path syntax is as follows:

Path = segment/segment/......

segment = * | {code: "group code"} | {name: "group name"}

Each segment can contain * (matches any group at that level), name of the group or code of the group. API can return one or more groups depending on the matches

Example of Path

Path = {name:"Training"}/{name: "Corporate"}/{name: "Sales"}

Path = {name:"Training"}/{name: "Corporate"}/*


API Details

Signature of API call

connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);

See details about invoking API in general


Parameter 1 - URI



Parameter 2 - UserName

Username of the site admin


Parameter 3 - Request Parameters

Name Value
dispatch createGroup
xml true
templateName Group Template Name
groupName Name of the group
domain Group Code
description Group Description
parentPath / separated path expression that contains either * or name or code for each level of the path specification in a group hierarchy.
maxUsers max active users possible in this group
allowedEmailDomains Comma separated email domains
customProperties Group custom properties having key, value pairs



Response on successfully creating the group

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">
            <![CDATA[Group created successfully]]>

Response on failing to create the group

HTTP Response Code = HttpServletResponse.SC_BAD_REQUEST

Response XML

<response code="0">
            <![CDATA[Invalid group template]]>
<response code="0">
            <![CDATA[Invalid path]]>


Code Snippet

/* Check API Call for detail */

Map<String, String> parameters = new HashMap<String, String>();
String result = connection.invokeApi("groupService.do", "adminusername", parameters);
private void populateMapForGroupCreation(Map<String, String> parameters) {
    parameters.put("dispatch", "createGroup");
    parameters.put("xml", String.valueOf(true));
    parameters.put("templateName", "Company Group Template");
    parameters.put("groupName", "New Group");
    parameters.put("domain", "Asia");
    parameters.put("description", "New group created under Sales group by API");
    parameters.put("maxMembers", String.valueOf(50));
    parameters.put("allowedEmailDomains", “acme.com, mycompany.com”);
    parameters.put("parentPath", "{name:\"Training\"}/{name: \"Corporate\"}/{name: \"Sales\"}");