beautypg.com

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

Page 14

background image

Google Search Appliance: Administrative API Developer’s Guide: .NET

14

Retrieve an individual crawler access rule as follows:

// Send the request and print the response
GsaEntry myEntry = myService.GetEntry("crawlAccessNTLM", "urlPattern");
Console.WriteLine("URL Pattern: " + myEntry.GetGsaContent("urlPattern"));
Console.WriteLine("User Name: " + myEntry.GetGsaContent("username"));
Console.WriteLine("Order: " + myEntry.GetGsaContent("order"));
Console.WriteLine("Domain: " + myEntry.GetGsaContent("domain"));
Console.WriteLine("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
myService.UpdateEntry("crawlAccessNTLM", "urlPattern", updateEntry);

Deleting a Crawler Access Rule

Delete a crawler access rule as follows:

myService.DeleteEntry("crawlAccessNTLM", "urlPattern");