beautypg.com

Updating a crawler access rule, Deleting a crawler access rule – Google Search Appliance Administrative API Developers Guide: Java User Manual

Page 14

background image

Google Search Appliance: Administrative API Developer’s Guide: Java

14

Retrieve an individual crawler access rule as follows:

// Send the request and print the response
GsaEntry myEntry = myClient.getEntry("crawlAccessNTLM", "urlPattern");
System.out.println("URL Pattern: " + myEntry.getGsaContent("urlPattern"));
System.out.println("User Name: " + myEntry.getGsaContent("username"));
System.out.println("Order: " + myEntry.getGsaContent("order"));
System.out.println("Domain: " + myEntry.getGsaContent("domain"));
System.out.println("Is Public: " + myEntry.getGsaContent("isPublic"));

Note: The password property doesn’t appear when retrieving crawler access rules.

Updating a Crawler Access Rule

Update a crawler access rule as follows:

// Create an entry to hold properties to update
GsaEntry updateEntry = new GsaEntry();

// Add properties to updateEntry
updateEntry.addGsaContent("urlPattern", "#new URL pattern");
updateEntry.addGsaContent("domain", "newdomain");
updateEntry.addGsaContent("isPublic", "0");
updateEntry.addGsaContent("order", "2");
updateEntry.addGsaContent("username", "newuser");
updateEntry.addGsaContent("password", "newpass");

// Send the request
myClient.updateEntry("crawlAccessNTLM", "urlPattern", updateEntry);

Deleting a Crawler Access Rule

Delete a crawler access rule as follows:

myClient.deleteEntry("crawlAccessNTLM", "urlPattern");