public ActionResult addAddress(Twilio.Address _address) { var twilio = new TwilioRestClient(AccountSid, AuthToken); try{ var addResult = twilio.AddAddress(_address.FriendlyName, _address.CustomerName, _address.Street, _address.City, _address.Region, _address.PostalCode, _address.IsoCountry); return(View("Addresses")); } catch (Exception ex) { return(View()); } }
public ActionResult Create(string FriendlyName, string CustomerName, string Street, string City, string Region, string PostalCode, string IsoCountry) { var accountSid = ConfigurationManager.AppSettings["TwilioAccountSid"]; var authToken = ConfigurationManager.AppSettings["TwilioAuthToken"]; var twilio = new TwilioRestClient(accountSid, authToken); var address = twilio.AddAddress(FriendlyName, CustomerName, Street, City, Region, PostalCode, IsoCountry); if (address.RestException != null) { return(new HttpStatusCodeResult(500, address.RestException.Message)); } return(RedirectToAction("Index", "Home")); }
static void Main(string[] args) { // Find your Account Sid and Auth Token at twilio.com/user/account string AccountSid = "{{ account_sid }}"; string AuthToken = "{{ auth_token }}"; var twilio = new TwilioRestClient(AccountSid, AuthToken); var options = new AddressOptions(); options.CustomerName = "Customer 456"; options.Street = "2 Hasselhoff Lane"; var address = twilio.AddAddress("Billing - Customer 123", "Customer 123", "2 Hasselhoff Lane", "Berlin", "Berlin", "10785", "DE"); Console.WriteLine(address.Sid); }