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.

REST_NET Example 2 (v1): Retrieving the list of profiles for a specified account

REST .NET Example 2: Retrieving the list of profiles for a specified account

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

1. Specify Service URL:

private const string serviceURL = "http://SERVER_NAME:URCHIN_PORT/services/v1/adminservice/profiles/";

2. Provide login and account information:

private const string login = "YOUR_LOGIN";
private const string password = "YOUR_PASSWORD";
private const int accountId = ACCOUNT_ID;

3. Compose REST URL:

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

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/");
                                // Get all profiles.
XPathNodeIterator profileXPathNodeIterator = xPathNavigator.Select("/tns:getProfileListResponse/profile", xmlNamespaceManager);

6. Display the information:

while (profileXPathNodeIterator.MoveNext())
        DisplayProfile(profileXPathNodeIterator.Current);

    .....

    // Function to display profile info.

private static void DisplayProfile(XPathNavigator profileXPathNavigator)
{
        Console.Write("Profile id is \"" + profileXPathNavigator.SelectSingleNode("profileId/text()") + "\", ");
        Console.Write("profile name is \"" + profileXPathNavigator.SelectSingleNode("profileName/text()") + "\", ");
        Console.Write("account id is \"" + profileXPathNavigator.SelectSingleNode("accountId/text()") + "\", ");
        Console.WriteLine("account name is \"" + profileXPathNavigator.SelectSingleNode("accountName/text()") + "\" ");
}

The full sample code for this example is available in AdminServiceGetProfileListREST.cs file.

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