TwilioApi: .NET wrapper for the Twilio REST API now available

The Twilio REST API wrapper I originally wrote for my Twin Cities .NET User Group talk is now available on GitHub. I believe it covers 100% of the API. It also includes what will most likely be the 1.0 version of RestSharp (to be officially released very soon). Try it out and let me know what you think.

Posted February 27th, 2010 11:10 PM
Read more posts about .NET, RestSharp.

View Comments
Link

  • Tim Barton
    Here is my code:

    Dim mySMSMeassgaes As SmsMessage
    Dim myTwilioApi As TwilioApi = New TwilioApi("xxx", "xxx")


    mySMSMeassgaes = myTwilioApi.SendSmsMessage("xxx", "xxxx", "This is a SMS Test")
  • Tim Barton
    Hi

    I am getting an error when I run the code.

    This property cannot be set after writing has started.

    in

    public RestResponse Execute(RestRequest request) {
    var client = new RestClient();
    client.Authenticator = new HttpBasicAuthenticator(_accountSid, _secretKey);
    client.BaseUrl = BaseUrl;
    request.AddParameter("AccountSid", _accountSid, ParameterType.UrlSegment);
    return client.Execute(request);
    }
  • GitHub has been updated with the fixed version of RestSharp (and Delta's in-flight Wifi rocks!)
  • Tim Barton
    Ok Sorry to bother you. Vaction is always important :)

    I downloaded the latest RestSharp and it worked. There is a bug in the GetSmsMessage function.

    I had to remove /{SMSMessageSid} from request.ActionFormat = "Accounts/{AccountSid}/SMS/Messages"; to get it to work.

    Thanks,
    Tim
  • I will have that fixed tomorrow. It's a bug in RestSharp that has been
    fixed there but not yet been moved upstream (and I'm just getting back
    from vacation).
  • Tim Barton
    I'm sorry it's in this function:

    public T Execute<t>(RestRequest request) where T : new() {
    var client = new RestClient();
    client.Authenticator = new HttpBasicAuthenticator(_accountSid, _secretKey);
    client.BaseUrl = BaseUrl;
    request.AddParameter("AccountSid", _accountSid, ParameterType.UrlSegment);
    return client.Execute<t>(request);
    }</t></t>
blog comments powered by Disqus