Submit Your Site For Free!

Email Address:
* URL:
*
*Indicates Mandatory Field

Terms & Conditions

CProgramTrends
FlashNewz
DevWebPro








ZoomInfo API - ASP.NET C#

By Manoj Jasra
Expert Author
Article Date: 2008-02-21

Over the last couple of days I have been digging into the ZoomInfo API (using C# - ASP.Net) to first of all better understand the API and secondly to leverage the data provided in order to use it for things like company profiling, competitors, and key contacts at a given company.

The ZoomInfo API gives you the ability to:

•Search for any person in the ZoomInfo database by name.

•Search for any company in the ZoomInfo database by name, domain, industry, keyword, geography, or company size.

• Get detailed information such as description, industries, address, stock ticker, key people, mergers and acquisitions, and more on any company in the ZoomInfo database.

•Get a list of competitors for any company in the ZoomInfo database.

Below is a sample URL to make an XML request for the ZoomInfo data:

http://api.zoominfo.com/PartnerAPI/XmlOutput.aspx?query_type=people_search_query&pc=&firstName=Brian&lastName=Balfour&key=

The "key" has to be generated by concatenating the following parameters:

1. First 2 letters of every search term in sequential order (*** Note for the Company Competitors Query, supply the whole CompanyID)
2. Your Shared Secret
3. Today's day (not padded with zero)
4. Today's month (not padded with zero)
5. Today's year (4 digit)

Below is a method you can use to generate the MD5 code:

// Create an md5 sum string of this string
public static string ZoomEncode(String str)
{
System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
byte[] bs = System.Text.Encoding.UTF8.GetBytes(str);
bs = x.ComputeHash(bs);
System.Text.StringBuilder s = new System.Text.StringBuilder();
foreach (byte b in bs)
{
s.Append(b.ToString("x2").ToLower());
}
return s.ToString();
}


Below is a method you can use in C# to retrieve the XML provided by the ZoomInfo API. It takes into account the type of request made, for company detail or company competitors:

public static String getCompanyDetail(String companyDomain, String queryType, String companyID)
{
StringBuilder urlBuffer = null;

urlBuffer = new StringBuilder("http://api.zoominfo.com/PartnerAPI/XmlOutput.aspx");


urlBuffer.Append("?query_type=");
if (queryType == "company_detail")
{
urlBuffer.Append("company_detail");
}
if (queryType == "company_competitors")
{
urlBuffer.Append("company_competitors");
}

urlBuffer.Append("&pc=");
urlBuffer.Append(zoomInfoKey);

if (0 != companyID.Length)
{
urlBuffer.Append("&CompanyID=");
urlBuffer.Append(companyID);
}

if (queryType == "company_detail")
{
urlBuffer.Append("&CompanyDomain=");
urlBuffer.Append(companyDomain);
}

String keySeed = "";

if (0 != companyID.Length)
{
keySeed = companyID;
}
else
{
keySeed = companyDomain.Substring(1, 2);
}
keySeed += secret + DateTime.Today.Day + DateTime.Today.Month + DateTime.Today.Year;

urlBuffer.Append("&key=");
urlBuffer.Append(ZoomEncode(keySeed));

try
{

HttpWebRequest request = WebRequest.Create(urlBuffer.ToString()) as HttpWebRequest;
request.ContentType = "text/xml;charset=\"utf-8\"";
request.Accept = "text/xml";
request.Method = "GET";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
using (StreamReader streamReader = new StreamReader(response.GetResponseStream()))
{
String temp = streamReader.ReadToEnd();
return temp;
}
}
}
catch (Exception ex)
{
Debug.Write(ex.Message);
}
return String.Empty;

}


Comments

About the Author:
Manoj Jasra has been in the search marketing industry since 2002 with Enquiro Search Solutions. His role as the Director of Technology at Enquiro involves him developing strategic relationships with technology vendors, overseeing web analytics and designing cutting edge solutions for clients. Manoj's background in software development and experience in search marketing/web analytics gives him the ability to provide strategic consultation throughout the entire online marketing process.

Manoj's blog, Web Analytics World focuses on insight in Search Marketing, Blogging, Web Analytics and Technology; it is also one of the top read web analytics blogs. You can frequently find Manoj's writing at popular marketing publications.



Newsletter Archive | Article Archive | Submit Article | Advertising Information | About Us | Contact

C Programming Trends is an iEntry, Inc. ® publication - 1998-2008 All Rights Reserved Privacy Policy and Legal