beautypg.com

Retrieving a search report, Updating a search report – Google Search Appliance Administrative API Developers Guide: .NET User Manual

Page 43

background image

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

43

For example, to specify the range of dates from 2 January 2009 to 23 September 2009, use this
statement:

insertEntry.addGsaContent(“reportDate”, “range_1_2_2009_9_23_2009);

A new search report entry will be generated and returned as follows.

GsaEntry insertEntry = new GsaEntry();
insertEntry.AddGsaContent("reportName", "bbb");
insertEntry.AddGsaContent("collectionName", "default_collection");
insertEntry.AddGsaContent("reportDate", "month_5_2009");
insertEntry.AddGsaContent("withResults", "true");
insertEntry.AddGsaContent("topCount", "100");
myService.InsertEntry("searchReport", insertEntry);

Retrieving a Search Report

Retrieve the search report status and get search log content by sending an authenticated GET request to
a search report entry of the searchReport feed.

A search report entry with log content (if content is ready) is returned:

GsaEntry entry = myService.GetEntry("searchReport", "bbb@default_collection");
Console.WriteLine("Entry Name: " + entry.GetGsaContent("entryID"));
Console.WriteLine("Report State: " + entry.GetGsaContent("reportState"));
Console.WriteLine("Report Creation Date: " +

entry.GetGsaContent("reportCreationDate"));

Console.WriteLine("Report Date: " + entry.GetGsaContent("reportDate"));
Console.WriteLine("Is Final: " + entry.GetGsaContent("isFinal"));
Console.WriteLine("With Results: " + entry.GetGsaContent("withResults"));
Console.WriteLine("Top Count: " + entry.GetGsaContent("topCount"));
Console.WriteLine("Diagnostic Terms: " + entry.GetGsaContent("diagnosticTerms"));

string status = entry.GetGsaContent("reportState");
if (status.Equals("2") || status.Equals("3")) {

Console.WriteLine("Report Content: " + entry.GetGsaContent("reportContent"));

}

Updating a Search Report

Update the search report status and get search report content by sending an authenticated PUT request
to a search report entry of the searchReport feed. There are no properties.

A search log entry is returned:

GsaEntry updateEntry = new GsaEntry();
myService.UpdateEntry("searchReport", "bbb@default_collection");

Year

year

_year

Date range

range

_month_day_year_month_day_year

Purpose

Format