API wrappers (C# and php)

Knowledge Level: 
Time: NA
Suggested Skills: Tessitura, SQL, C#, php, API
Objective: The mail2 API has two wrappers that can be used to make development more efficient. C# and php wrappers are offered and can be downloaded at the bottom of this article. The C# wrapper requires JSON .NET in order to function.

C# wrapper examples:

Import the class

import mail2REST

All rest services are methods of the mail2REST class, and can be executed as follows:

string apikey = 'yourAPIkeyHere';
string result = '"";
Dictionary<string,string> optionalParameters = new Dictionary<string,string>;
mail2 = new mail2(apikey,false);
result = mail2.List_Add_Public('List Name Here',optionalParameters);

php wrapper examples:

Include the mail2 class


Create your new class object and execute methods:

$apiKey = 'your api key';
$optionalParameters = array();
$mail2 = new mail2($apiKey,false);
$result = $mail2->List_Add_Public('List Name Here',$optionalParameters);


Responses are converted to either arrays or dictionaries from JSON as part of the wrapper class, and so results to the requests, when there is an array of contacts, can be accessed as part of a dictionary, or array. 

If the API throws an exception, the response is converted to a standard exception object for proper error handling.



Still need help? Contact Us Contact Us