Exigo Developer Resources

This database contains the documentation for Exigo's OData API's, as well as C# sample code and fully-realized demo applications ready to be customized for your needs. Start building downline viewers, reporting tools and shopping carts on the Exigo platform today!

Create an account Sign In

Rank Advancement


A report-card-styled report that informs a customer what rank they are qualified for, and what it will take to advance to any other rank.


This sample requires the following namespaces:

using ExigoOData;
using ExigoWebService;
using System.Text;
using System.Data.Services.Client;

Exigo API Authentication

This sample accesses OData using the ExigoContext object:

    public ExigoContext ExigoOData
            var context = new ExigoOData.ExigoContext(new Uri("http://api.exigo.com/4.0/" + exigoAPICompany + "/model"));
            context.IgnoreMissingProperties = true;
            var credentials = Convert.ToBase64String(Encoding.ASCII.GetBytes(exigoAPILoginName + ":" + exigoAPIPassword));
            context.SendingRequest +=
                (object s, SendingRequestEventArgs e) =>
                    e.RequestHeaders.Add("Authorization", "Basic " + credentials);
            return context;

This sample also accesses the web service using the ExigoApi object:

    public ExigoApi ExigoAPI
            return new ExigoApi
                ApiAuthenticationValue = new ApiAuthentication
                    LoginName = exigoAPILoginName,
                    Password = exigoAPIPassword,
                    Company = exigoAPICompany


We use Jquery for easier AJAX calls and DOM manipulation.

<link href="<%=this.ResolveUrl("../../Themes/start/jquery-ui.custom.css") %>" rel="stylesheet" type="text/css" />
<script src="<%=this.ResolveUrl("../../Scripts/jquery.min.js") %>" type="text/javascript"></script>
<script src="<%=this.ResolveUrl("../../Scripts/jquery-ui.min.js") %>" type="text/javascript"></script>

Fetching All Ranks

To fetch a list of all ranks, we use the OData's Ranks query:

        // Fetch the ranks
        var ranks = from r in ExigoOData.Ranks
                    where r.RankID > 0
                    orderby r.RankID descending
                    select r;

Fetching Rank Qualifications

To fetch the qualifications for the selected rank, we use the web service's GetRankQualifications method:

        // Fetch the provided rank's qualifications
        var response = ExigoAPI.GetRankQualifications(new GetRankQualificationsRequest
            CustomerID = customerID,
            PeriodType = periodType,
            RankID = selectedRankID

Rendering The Report

Whenever we want to request rank qualifications for the selected rank, including when the page loads, we use jQuery's AJAX function to call the current page while passing in two query string parameters, called "datakey" and "rankid".

                url: '<%=Request.Url.AbsolutePath %>?datakey=' + dataKey + '&rankid=' + query,
                cache: false,
                method: 'GET',
                success: function (data) {
                error: function (data, status, error) {
                    RetryTimeout = window.setTimeout(function() {
                    }, 5000);

On the server-side, we have overridden the Page's Render method to handle page requests differently if the query string parameter "datakey" exists.

    protected override void Render(HtmlTextWriter writer)
        // If we have a query string parameter called "datakey", render the Ajax responses instead of the normal page.
        if (Request.QueryString["datakey"] != null)
            // Clear the response

            // Check our datakey
            switch (Request.QueryString["datakey"])
                case "qualifications":
                        // Render our rank qualifications
                        RenderQualifications(writer, ViewingRankID);
                    catch (Exception ex)
                        // If the exception's message is 'Unavailable', the report has not yet fully loaded. Tell the client-side so it can try again.
                        if (ex.Message.Contains("Unavailable"))
                            throw ex;

            // End the response