Previous Topic: CCS API Usage ExamplesNext Topic: Get Existing Classifications for a URL


Retrieve Full List of Dictionary Classifications

This example shows how a client queries the CCS to get a full list of Dictionary Classifications that content can be classified against.

// Create the proxy class that connects to the remote service.
CCS.CCSDictionaryClient proxyDictionary = new CCS.CCSDictionaryClient();

// Create the arguments object and set options
CCS.DictionaryArgs dictionaryArgs = new CCS.DictionaryArgs();

// Set the locale
dictionaryArgs.Locale = "en-gb";

// Call the Dictionary service to get the dictionary classifications
// which are returned in a DictionaryResult instance
CCS.DictionaryResult dictionaryResult = 
  proxyDictionary.GetDictionaryClassifications(dictionaryArgs);

// A real client would check the error status here
Console.WriteLine("Severity: {0}   ErrorCode: {1} = {2}", 
  dictionaryResult.Severity.ToString(), 
  dictionaryResult.ErrorCode.ToString(),
  dictionaryResult.ErrorMessage);

// Process the classifications from the list
foreach (var classItem in dictionaryResult.DictionaryClassifications)
{
  Console.WriteLine("ClassificationID: {0}", classItem.ClassificationID);
}

// The proxy instance can be used for multiple calls but should
// be closed when no longer required.
proxyDictionary.Close();