Kentico CMS 7.0 On-line Marketing Guide

Customizing the Data.com integration

Customizing the Data.com integration

Previous topic Next topic Mail us feedback on this topic!  

Customizing the Data.com integration

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

If you wish to customize any aspect of the Data.com integration, you need to request your own API access token from Data.com.

 

 

InfoBox_Exclamation

 

Important!

 

Modifying or extending the default functionality without using your own Data.com token is a violation of the licensing terms.

 

 

Using a custom Data.com API token

 

Follow the steps below if you need to work with a custom Data.com access token in your API:

 

1. Open your web project in Visual Studio.

 

2. Create a new class:

 

In the project's App_Code folder (or Old_App_Code if the project is installed as a web application)
OR

As part of a custom assembly (Class library)

 

3. Add a reference to the CMS.DataCom namespace:

 

[C#]

 

using CMS.DataCom;

 

4. Make the class implement the ITokenProvider interface.

5. Add the GetToken() method and return your Data.com token as a string:

 

[C#]

 

public class CustomDataComTokenProvider : ITokenProvider
{
    /// <summary>
    /// Gets the token used for Data.com communication.
    /// </summary>
    /// <returns>Token</returns>
    public string GetToken()
    {
        return "Your Data.Com API Token";
    }
}

 

Whenever you call the DataComHelper.CreateClient method in your custom code, add an instance of your ITokenProvider class as a parameter:

 

[C#]

 

using CMS.DataCom;

 
...

 
DataComClient client = DataComHelper.CreateClient(new CustomDataComTokenProvider());