Collections, Creating a collection, Retrieving all collections – Google Search Appliance Administrative API Developers Guide: Java User Manual
Page 22

Google Search Appliance: Administrative API Developer’s Guide: Java
22
Collections
Retrieve, update, create, or delete the collections of documents on the search appliance.
Creating a Collection
Create a new collection as follows:
// Create an entry to hold properties to insert
GsaEntry insertEntry = new GsaEntry();
// Add a property to insertEntry
insertEntry.addGsaContent("collectionName", "new_collection");
insertEntry.addGsaContent("insertMethod", "default");
// Send the request
myClient.insertEntry("collection", insertEntry);
Create a new collection with a default setting as follows:
insertEntry.addGsaContent("insertMethod", "default");
Specify the settings for a new collection as follows:
// Add property for insertEntry
insertEntry.addGsaContent("collectionName", "new_collection");
insertEntry.addGsaContent("insertMethod", "customize");
insertEntry.addGsaContent("followURLs", "#url to follow");
insertEntry.addGsaContent("doNotCrawlURLs", "#url to not follow");
Retrieving All Collections
Retrieve a list of collections as follows:
// Send the request and print the response
GsaFeed myFeed = myClient.getFeed("collection");
for(GsaEntry myEntry : myFeed.getEntries()) {
System.out.println("Collection Name: " + myEntry.getGsaContent("entryID"));
System.out.println("Follow URLs: " + myEntry.getGsaContent("followURLs"));
System.out.println("Do Not Crawl URLs: " + myEntry.getGsaContent
("doNotCrawlURLs"));
}
Property
Description
collectionName
The name of the collection to create, which is only required when creating a
new collection.
doNotCrawlURLs
The URL patterns of content that you want to exclude from this collection.
followURLs
The URL patterns of content that you want to include in this collection.
importData
Indicates that the collection settings exported from the Admin Console are only
required when creating a new collection from an import.
insertMethod
The method of creating a new method, which is only required when creating a
new collection. Possible values: default, customize, import.