Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Implement create address code snippets #466

Merged
merged 1 commit into from
Aug 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Download the Node helper library from twilio.com/docs/node/install
// These identifiers are your accountSid and authToken from
// https://www.twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const client = require('twilio')(accountSid, authToken);

client.addresses
.create({
customerName: 'FriendlyName',
street: 'Elm Street',
city: 'Racoon',
region: 'Mordor',
postalCode: '150',
isoCountry: 'AX',
})
.then(address => console.log(address.customerName));
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Api.V2010.Account;

class Example
{
static void Main(string[] args)
{
// Find your Account Sid and Auth Token at twilio.com/console
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
const string authToken = "your_auth_token";
TwilioClient.Init(accountSid, authToken);

var address = AddressResource.Create(
customerName: "FriendlyName",
street: "Elm Street",
city: "Racoon",
region: "Mordor",
postalCode: "150",
isoCountry: "AX"
);

Console.WriteLine(address.CustomerName);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$address = $client
->addresses
->create(
'FriendlyName',
'Elm Street',
'Racoon',
'Mordor',
'150',
'AX'
);

echo $address->customerName;
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'

# Initialize Twilio Client
@client = Twilio::REST::Client.new(account_sid, auth_token)

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@address = @client.api.addresses.create(
customer_name: 'FriendlyName',
street: 'Elm Street',
city: 'Racoon',
region: 'Mordor',
postal_code: '150',
iso_country: 'AX')

puts @address.customer_name
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

address = client.addresses.create(
customer_name='FriendlyName',
street='Elm Street',
city='Racoon',
region='Mordor',
postal_code='150',
iso_country='AX')

print(address.customer_name)
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Address;

public class Example {
// Find your Account Sid and Token at twilio.com/user/account
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
public static final String AUTH_TOKEN = "your_auth_token";

public static void main(String[] args) {
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
Address address = Address.creator(
"FriendlyName",
"Elm Street",
"Racoon",
"Mordor",
"150",
"AX"
).create();

System.out.println(address.getCustomerName());
}
}
4 changes: 4 additions & 0 deletions rest/addresses/instance-create-example/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"title": "Instance Create Example",
"type": "server"
}