beautypg.com

Creating a group, Retrieving groups, Deleting members of a group – Google Search Appliance Policy ACL API Developers Guide User Manual

Page 15: Adding a member to a group, Retrieving group members

background image

Google Search Appliance: Policy ACL API Developer’s Guide

Policy ACL API Developer’s Guide

15

Creating a Group

To create a new group:

GsaEntry insertEntry = new GsaEntry();
insertEntry.Properties.Add(new PropertyElement("groupId", "testGroup"));
service.Insert(new Uri("http://Search_Appliance:8000/a/feeds/group/2.0/domain"),
insertEntry);

Retrieving Groups

To retrieve all groups:

GsaFeed resultFeed = service.Query(new FeedQuery("http://gsa.example.com:8000/a/
feeds/group/2.0/domain")) as GsaFeed

If the number of groups in the search appliance is more than 500, the result is represented in multiple
pages—you can access the next page as follows:

if ((next = feed.Links.FindService("next", null)) != null)
{

resultFeed = Query(new Uri(next.HRef.ToString())) as GsaFeed;

}

Deleting Members of a Group

To delete members of a group, use the following DELETE request:

DELETE http://Search_Appliance:8000/a/feeds/group/2.0/domain/groupId

Take note that this request only deletes members of a group, it does not delete the empty group.

Adding a Member to a Group

To add a member to a group:

GsaEntry insertEntry = new GsaEntry();
insertEntry.Properties.Add(new PropertyElement("memberId", "john"));
insertEntry.Properties.Add(new PropertyElement("memberType", "User"));
// Adds member user "john" to group "testGroup"
service.Insert(new Uri("http://Search_Appliance:8000/a/feeds/group/2.0/domain
/testGroup/member"), insertEntry);

Retrieving Group Members

To retrieve all members of group:

GsaFeed resultFeed = service.Query(new FeedQuery("http://Search_Appliance:8000/a
/feeds/group/2.0/domain/testGroup/member")) as GsaFeed

If the number of members in a group is more than 500, the result is represented in multiple pages—you
can access the next page as follows:

if ((next = feed.Links.FindService("next", null)) != null)
{

memberFeed = Query(new Uri(next.HRef.ToString())) as GsaFeed;

}