C# SDK Documentation

The C# SDK provides an easy to use interface to the DataSoap API, allowing developers to build
bespoke solutions quickly using our data cleansing / validation services.

Installing

You can download the latest and greatest version of the DataSoap SDK for C# from Nuget below. Nuget is a package manger for the DotNet framework.

Step by Step (Visual Studio)

To install the DataSoap Nuget package you can either use the Package Manager UI or the Package Manager Console from Visual Studio.

Package Manager UI

  1. In the Solution Explorer, right click on your project references and select ‘Manage NuGet Packages’
  2. Ensure ‘nugget.org’ is selected as the Package Source and on the Browse tab is selected
  3. Search for DataSoap_SDK
  4. Click on the package
  5. Press Install

Package Manager Console

  1. From the top bar, Select ‘Tools’ > ‘NuGet Package Manager’ > ‘Package Manager Console’
  2. The console will open, select the project you wish to install the package as the Default Project
  3. Enter the command ‘Install-Package DataSoap_SDK’

Using the SDK

Once the SDK has been included into a project you can start using it defining a using statement for the SDK namespace ‘DataSoap_SDK’

using DataSoap_SDK;

To start making requests to the API you can use the ‘DataSoapApiV2’ which requires a private API token

using (var ds = new DataSoapApiV2("your_private_token"))
{

}

The client has methods covering the majority of validation api's functionality you can read more about the api here.

Examples

using (var ds = new DataSoapApiV2("your_private_token"))
{
    ds.OnException((ex) =>
    {
        // Do any exception handling here (Mainly httpclient)
    });


    // Perform lookup (Will use credit depending on avilablity and data type)
    var result = await ds.ValidateAsync("phone_number_or_email");

    // Get valid status from result
    var valid = result.Valid;

    // Note the result contains additional information regarding the data
    // as well as the individual lookups
}
using (var ds = new DataSoapApiV2("your_private_token"))
{
    ds.OnException((ex) =>
    {
        // Do any exception handling here (Mainly httpclient)
    });


    // Perform lookup
    var result = await ds.ValidateAsync("phone_number_or_email", V2RequestType.Syntax, V2RequestType.Tps, V2RequestType.Hlr);

    // Get valid status from result
    var valid = result.Valid;

    // Get results of each of thre requests lookup types
    var syntax = result.Syntax;
    var tps = result.Tps;
    var hlr = result.Hlr;

}
using (var ds = new DataSoapApiV2("your_private_token"))
{
    ds.OnException((ex) =>
    {
        // Do any exception handling here (Mainly httpclient)
    });


    // Get all credit balances
    var balances = await ds.BalanceAsync();

    // Get balance for just HLR
    var hlrBalance = await ds.BalanceAsync(V2BalanceType.Hlr);

}