Notification

Urchin WebAnalytics Software is discontinued and is no longer supported. All Urchin documentation applies only to the Urchin product as it was at the time of discontinuation, and does not apply to any Google Analytics products or services.

The page you've requested isn't currently available in your language. You can instantly translate any webpage into a language of your choice, using Google Chrome's built-in translation feature.

REST_NET Example 1 (v1): Retrieving the list of accounts for an authenticated user

REST .NET Example 1: Retrieving the list of accounts for an authenticated user

(Return to main article: Samples for .NET (REST) v1)

1. Specify service URL:

private const string serviceURL = "http://server[:port]/services/v1/adminservice/accounts/";

2. Provide login information:

private const string login = "YOUR_LOGIN";
private const string password = "YOUR_PASSWORD";

3. Compose the REST URL:

string url = serviceURL + "?login=" + login + "&password=" + password;

4. Retrieve account list:

XPathDocument xPathDocument = new XPathDocument(url);

5. Parse response:

XPathNavigator xPathNavigator = xPathDocument.CreateNavigator();
XmlNameTable xmlNameTable = new NameTable();
XmlNamespaceManager xmlNamespaceManager = new XmlNamespaceManager(xmlNameTable);
xmlNamespaceManager.AddNamespace("tns", "https://urchin.com/api/urchin/v1/");
XPathNodeIterator accountXPathNodeIterator = xPathNavigator.Select("/tns:getAccountListResponse/account", xmlNamespaceManager);

6. Display the information about retrieved accounts:

while (accountXPathNodeIterator.MoveNext())
        DisplayAccount(accountXPathNodeIterator.Current); 
...
// Function to display account info.

private static void DisplayAccount(XPathNavigator accountXPathNavigator)
{
        Console.Write("Account id is \"" + accountXPathNavigator.SelectSingleNode("accountId/text()") + "\", ");
        Console.Write("name is \"" + accountXPathNavigator.SelectSingleNode("accountName/text()") + "\", ");
        Console.Write("contact name is \"" + accountXPathNavigator.SelectSingleNode("contactName/text()") + "\", ");
        Console.Write("e-mail is \"" + accountXPathNavigator.SelectSingleNode("emailAddress/text()") + "\" ");
        Console.WriteLine("and phone number is \"" + accountXPathNavigator.SelectSingleNode("phoneNumber/text()") + "\".");
}

Complete sample code for this example is available in the AdminServiceGetAccountListREST.cs file.

(Return to main article: Samples for .NET (REST) v1)

 
true
Search
Clear search
Close search
Main menu
13394707423532398984
true
Search Help Center
true
true
true
false
false