SMS API Documentation

Wrappers :: C#

Send SMS using our .NET class library.   We’ve done all the hard work creating the XML, you just need to write a few lines of code.

Download the project or the compiled library

Example

using System;
using System.Net;
using Mediaburst.API;

class DemoSMS
{
    static void Main(string[] args)
    {
        try
        {
            SMS sms = new SMS("username", "password");
            SMSResult result = sms.Send("441234567890", "Hello World");

            if (result.Success)
                Console.WriteLine("Sent, ID: " + result.ID);
            else
                Console.WriteLine("Error: " + result.ErrorMessage);
        }
        catch (APIException ex)
        {
            // You'll get an API exception for errors
            // such as wrong username or password
            Console.WriteLine("API Exception: " + ex.Message);
        }
        catch (WebException ex)
        {
            // Web exceptions mean you couldn't reach the mediaburst server
            Console.WriteLine("Web Exception: " + ex.Message);
        }
        catch (ArgumentException ex)
        {
            // Argument exceptions are thrown for missing parameters,
            // such as forgetting to set the username
            Console.WriteLine("Argument Exception: " + ex.Message);
        }
        catch (Exception ex)
        {
            // Something else went wrong, the error message should help
            Console.WriteLine("Unknown Exception: " + ex.Message);
        }
    }
}

Full documentation can be found in the readme file. If you have any questions get in touch.