Posted on October 6th, 2020
This is Part Two of a two-part series showing the power of using APIs with data virtualization solutions.
Data Virtualization enables disparate data sources across an organization to be viewed and made accessible within a single logical data layer. This allows aggregated data to be delivered to business users in real-time, as well as provides the foundation for data warehouses, data lakes, and other analytics sources.
In this walkthrough example, Denodo is used to perform a Join on a virtual database with Interzoid’s Cloud-based Global Telephone Information API. This will enrich a list of international telephone numbers with specific location, language, and other useful information. This demonstrates how Denodo can be used to enrich data with external APIs.
If you do not have Denodo, a limited-version called Denodo Express is available as a free download here and will work with this walkthrough.
Interzoid’s Global Telephone Information JSON API provides several data points that have been aggregated together for a telephone number anywhere in the world. Additional knowledge about international customers, prospects, and site visitors can provide a better communication experience for an organization, ultimately providing more business value.
Here is an example of enrichment data collected from Interzoid’s Global Telephone Information API keyed from only an international phone number:
The additional international information can be useful in marketing campaigns, in sales scenarios, data science initiatives, and other advanced analytics.
How to enhance international telephone number data in Denodo using data virtualization:
There are five steps in this example:
Step #1: Create a Data Source and Base View within Denodo for the source data
Step #2: Configure the Interzoid Global Telephone Information API as a Data Source
Step #3: Configure the Interzoid API Base View
Step #4: Define the Derived View using a Join function
Step #5: Execute the Join function to display results
Step #1 – Create a Data Source and Base View within Denodo for the source data
In this example, for simplicity we will use an Excel workbook file as the data source (we could have just as easily used JDBC, ODBC, or one of the several other data sources available within Denodo). It is a list of international telephone numbers. Filename: “Example 2 – GlobalPhones.xlsx”
Within the Virtual DataPort Administration Tool (VDP) of Denodo, select “Database Administration” and create a new Server for this walkthrough. Call it “Example2.” Then, from the “Example2” folder in the Server tree, create a new folder called “Data Sources” and another one called “Base Views.” Within the “Data Sources” folder, create a new Excel Data Source.
Next, change the File Location setting to “Local” and click the “Configure” button. Provide the path of the included Excel file and click “Ok.” Name the Data Source “phonenumbers_excel”. Check the “has headers” option and click “Save”:
Next, click the “Create base view” button on the top. Once the Base View has been created and is displayed, click “Save”:
You should now have both a Data Source and the corresponding Base View in your Server tree (you might need to drag the new Base View to the Base View folder):
Step #2 – Configure the Interzoid Global Telephone Information API as a Data Source
The API we will use is a REST-based API that we will access using query parameters with a URL location. Data is returned from this API in JSON format, so we will set the data source up in Denodo accordingly.
For more technical information about the API: https://interzoid.com/apis/global-telephone-validation-demographics
Create a new data source of type “JSON”:
Name the data source: “interzoid_global_phone_api”
For the “Data Route”, choose “HTTP Client” and then click the “Configure” button:
The end point for this particular API is: https://api.interzoid.com/getglobalnumberinfo
Calling the API requires two parameters:
License: A license key issued from Interzoid (a limited key is provided for this example, additional license keys can be obtained from Interzoid)
International Phone Number: Phone number, starting with country code, to retrieve data for
In this example, we will hard-code a value for the “license” parameter. For the other parameter, “intlnumber”, we will use an “interpolated value”, as this tells Denodo to use a variable when calling the API. In our case, the variable will be phone number values from the phone number list Base View that we have already set up with the Excel file as the data source.
To achieve this, in the URL field when configuring the HTTP client, we will provide the endpoint along with the query parameters. You can see the hard-coded value for “license”, and then also how the interpolated variable is denoted within the API call URL using an @ symbol and brackets: https://api.interzoid.com/getglobalnumberinfo?license=YOURLICENSEKEY&intlnumber=@{intl_number}
(Note: if you don't have a license key, register at https://www.interzoid.com/register-api-account)
Click “OK”, and then “Save.” The configured Data Source will appear on the Server tree:
Step #3 – Configure the Interzoid API Base View
On the Configuration Panel for the “Interzoid_global_phone_api” Data Source, click “Create Base View.” You will see the following:
Click the blue edit pen and then enter the interpolation variable notation below including the brackets(any phone number will do):
Then click “OK”, then “Next”, and then “OK” again at the “Configure JSON Wrapper” panel without any changes.
You should then see the following:
The “intl_number” field is the input parameter to the API. The other fields are all output parameters that will comprise the output results and contain the international demographic info.
Click the blue “Save” disk to save the Base View. You should now have the new Base View available on the Server tree as shown:
Step #4 – Create the Derived View using a Join function
Create a new folder called “Derived Views” to follow Denodo guidelines. This is where the Data Virtualization will occur and from where we can execute our Join function. This will call the API with each value in the phone number list data source, augmenting them with the demographic data for each and making the enhanced data available within a Derived View (the logical data layer).
In this folder, create a new Join function:
Then, drag the two Base Views from the tree onto the Join configuration panel. The panel should look like this:
Next, drag the “telephone” field of the phone number list Base View to the “intl_number” field of the Interzoid API Base View. You should see a line connecting the two fields (defining the Join) like this:
Next, define the output of the Derived View. Click the “output” tab. Then, check the three fields as shown below.
The third field selected is the input to the API. This will be the same as the intl_number field, so we do not need to see it twice. Also, “code” and “credits” are administrative data coming from the API that are not relevant to the Join, so check those as well. After the fields are checked, click the “Remove selected” button at the bottom of the panel. You should now see this:
Click the blue disk “Save” button. The Join function’s Derived View will now appear in the Derived Views folder on the Server tree:
Step #5 – Execute the Join function to display results
Within the configuration panel for the Derived View, click the “Execution Panel” arrow at the top. You should see the following:
We are ready to execute the Join function that will build the Derived View by calling the API once for each record in the telephone number list Base View. To execute, click the white arrow in the green circle “Execute” button.
You should see the “Executing query…” message. This will take a few seconds as Denodo is going to the Web to execute the Interzoid Global Telephone API for the purposes of retrieving the enrichment data.
You will then see the results as shown. For each phone number, you will see corresponding demographic data:
Where from here?
Now that our global telephone numbers have been enriched, there are several potential courses of action to take, depending on business requirements.
For example, data from this logical data layer can be exported for further analysis and use. Within Denodo, results can be saved/exported to a delimited file for review or additional processing.
This walkthrough is only one example of integrating Interzoid APIs within Denodo. There are other data enrichment APIs that can augment existing sources of data with new information. There are also matching APIs that include specific matching algorithms for different types of data such as individual names (Bob = Robert, Johnson = Jonsen) or company names (IBM = International Business Machines).
For more information, contact support@interzoid.com or visit https://www.interzoid.com
For a PDF version of the walkthrough, click here.