How to list members of a group using the principal-list API.
In order to list members of a particular group using the principal-list API you will first need to call the principal-list to list all the groups:
Here is how the API call should be made:
http://FQDN/api/xml?action=principal-list&filter-has-children=true
Here is a sample output:
<principal principal-id="56001" account-id="7" type="group" has-children="true" is-primary="false" is-hidden="false" training-group-id="">
<name>aaa</name>
<login>aaa</login>
<display-uid>aaa</display-uid>
<description>AAA</description>
</principal>
From the above call you will need to parse the principal-id of the group whose members you want to list:
Once you have parsed the principal-id, which in this example will be “56001“, you will need to call the principal-list again like this:
http://FQDN/api/xml?action=principal-list&group-id=56001&filter-is-member=true
This will list all the users who are members of the group labeled as “aaa”.
Here is a sample output:
<results>
<status code=”ok” />
<principal-list>
<principal principal-id=”11822″ account-id=”7″ type=”user” has-children=”false” is-primary=”false” is-hidden=”false” training-group-id=””>
<name>test one</name>
<login>test1@adobe.com</login>
<email>test1@adobe.com</email>
<display-uid>test1@adobe.com</display-uid>
<is-member>true</is-member>
</principal>
<principal principal-id=”11823″ account-id=”7″ type=”user” has-children=”false” is-primary=”false” is-hidden=”false” training-group-id=””>
<name>test two</name>
<login>test2@adobe.com</login>
<email>test2@adobe.com</email>
<display-uid>test2@adobe.com</display-uid>
<is-member>true</is-member>
</principal>
<principal principal-id=”187801″ account-id=”7″ type=”user” has-children=”false” is-primary=”false” is-hidden=”false” training-group-id=””>
<name>test three</name>
<login>test3@adobe.com</login>
<email>test3@adobe.com</email>
<display-uid>test3@adobe.com</display-uid>
<is-member>true</is-member>
</principal>
</principal-list>
</results>
Applicable for Connect 9.x.