The API is available as a web service via SOAP or XML-RPC messaging. A downloadable Java client library contains client stub files that make using the API very easy for Java users. For .NET and other clients, the WSDL file that describes the API SOAP interfaces in a standard XML format.
Java
For Java development, use the whatcountsapi.jar library, which contains stub interfaces for the entire API. This is implemented using Apache Axis, an open source SOAP library. Download the whatcountsapi.jar for Java at:
https://secure.whatcounts.net/api/downloads/whatcountsapi.jar
For Broadcasters, go to:
http://[siteURL]/api/downloads/whatcountsapi.jar
Where [siteURL] is the domain of your email platform.
.NET
If you use Visual Studio to develop for the .NET platform, generate proxy client code for the WebServices API by creating a Web Reference in your Visual Studio project. Download the WSDL at:
http://api.whatcounts.net/wsdl/WhatCountsAPI.wsdl
For Broadcasters, go to:
http://[siteURL]/wsdl/WhatCountsAPI.wsdl
Where [siteURL] is the domain you use to access your system.
You can also use the wsdl.exe command line tool that comes with .NET Visual Studio:
C:> wsdl http://api.whatcounts.net/wsdl/WhatCountsAPI.wsdl /language:cs
This command will create a source file WhatCountsAPIService.cs in the current directory that can then be compiled into a DLL:
C:> csc /t:library /r:System.Web.Services.dll WhatCountsAPIService.cs
Set the Endpoint
The WSDL file default URL points to: http://api.whatcounts.net If your Realm is not hosted on the main WhatCounts SAAS platform, you must programmatically change the endpoint URL to point to your Broadcaster. The last line should change from:
<wsdlsoap:address location="http://api.whatcounts.net/webservices/WhatCountsAPI"/>
To:
<wsdlsoap:address location="http://[siteurl]/webservices/WhatCountsAPI"/>
Where [siteURL] is the domain you use to access your system.
In .NET (C#, VB.NET), this change can be made in code, or in web.config. If this change is not made you will experience authentication issues.
Session Management
To login and start a session, read in the License Key and pass it as a String value to the WhatCountsAPI.beginSession(String) method. A session token (cookie) is returned. Pass along this cookie to the other API methods for the duration of the session. Once you are done, close the session with WhatCountsAPI.endSession (cookie) to remove the session data on the server side.
To see an example of session management and using the libraries, see Code Examples.