SEO Metadata | ||
---|---|---|
| ||
|
Our API wrappers offer you simplicity with the greatest flexibility. This document describes the C# wrapper library, which makes it really easy to use our most feature-rich API in your C# code through simple function calls.
To send an SMS with our C# wrapper, download and unzip the wrapper from here, then copy the RestClient.cs or the DLL RestClient.dll into your project folder. You must use the RestClient assembly in your C# code e.g:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
using RestAPI; |
Now put the following code somewhere in a C# file and execute it to send an SMS – don't forget to substitute your own API username and password and a real mobile number to send to!
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
using System; using RestAPI; using System.Collections; namespace ExampleRestAPI { class Example { static void Main(string[] args) { RestClient tmClient; tmClient = new RestClient("myAPIusername", "myAPIpassword",RestClient.ENV_PRODUCTION); try { Hashtable result = tmClient.sendSMS("My message", "447000000000", "Sender", 72, "", "", null); Console.WriteLine("Used {0} Credits, ID:{1}, Status: {2}",result["credits_used"], result["message_id"], result["status"]); } catch (RestClientException e) { Console.WriteLine(e.Message); foreach (DictionaryEntry de in tmClient.getLastErrors()) Console.WriteLine("Error {0}: {1}", de.Key, de.Value); } Console.WriteLine(); Console.Write("Press ENTER to continue"); Console.ReadLine(); } } } |
Tip |
---|
You can find your API username and password (which may be different to your web interface username/password) via your account: https://messagebox.textmarketer.co.uk/#!accountsettings/
|
Warning | ||
---|---|---|
| ||
Our example code is an illustration of how you might integrate with our systems and is not certified for production environments. You are responsible for testing and QA. |
Panel | ||
---|---|---|
| ||
|