Skip to content

Commit af111b8

Browse files
committed
Add device/retrieve-device snippets
1 parent cbd4c32 commit af111b8

File tree

6 files changed

+105
-4
lines changed

6 files changed

+105
-4
lines changed

deployed-devices/rest/devices/retrieve-device/retrieve-device.3.x.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
2-
const authToken = 'your_auth_token';
1+
// Get the Node helper library from https://twilio.com/docs/libraries/node
2+
const fs = require('fs');
33
const Twilio = require('twilio').Twilio;
44

5+
// Get your Account SID and Auth Token from https://twilio.com/console
6+
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
7+
const authToken = 'your_auth_token';
58
const client = new Twilio(accountSid, authToken);
6-
const fleet = client.preview.deployed_devices.fleets('FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX');
79

8-
fleet
10+
const fleetSid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
11+
const fleetService = client.preview.deployed_devices.fleets(fleetSid);
12+
13+
fleetService
914
.devices('THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
1015
.fetch()
1116
.then(response => {
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/csharp
2+
using System;
3+
using System.Collections.Generic;
4+
using Twilio;
5+
using Twilio.Rest.Preview.DeployedDevices.Fleet
6+
7+
public class Example
8+
{
9+
public static void Main(string[] args)
10+
{
11+
// Get your Account SID and Auth Token from https://twilio.com/console
12+
const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
13+
const string authToken = "your_auth_token";
14+
TwilioClient.Init(accountSid, authToken);
15+
16+
const string fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
17+
const string deviceSid = "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
18+
const DeviceResource device = DeviceResource.Fetch(fleetSid, deviceSid);
19+
20+
Console.WriteLine(device.Sid);
21+
}
22+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
// Get the Node helper library from https://twilio.com/docs/libraries/php
3+
require_once '/path/to/vendor/autoload.php'; // Loads the library
4+
5+
use Twilio\Rest\Client;
6+
7+
// Get your Account SID and Auth Token from https://twilio.com/console
8+
$accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
9+
$authToken = 'your_auth_token';
10+
$client = new Client($sid, $token);
11+
12+
$fleetSid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
13+
$fleetService = $client->preview->deployedDevices->fleets($fleetSid);
14+
15+
$device = $fleetService
16+
->devices("THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
17+
->fetch();
18+
19+
echo $device;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/ruby
2+
require 'twilio-ruby'
3+
4+
# Get your Account SID and Auth Token from https://twilio.com/console
5+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
6+
auth_token = 'your_auth_token'
7+
client = Twilio::REST::Client.new(account_sid, auth_token)
8+
9+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
10+
fleet_service = client.preview.deployed_devices.fleets(fleet_sid)
11+
12+
device = fleet_service
13+
.devices("THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
14+
.fetch()
15+
16+
puts device
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Get the Node helper library from https://twilio.com/docs/libraries/python
2+
from pathlib import Path
3+
from Twilio.rest import Client
4+
5+
# Get your Account SID and Auth Token from https://twilio.com/console
6+
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
7+
auth_token = 'your_auth_token'
8+
client = Client(account_sid, auth_token)
9+
10+
fleet_sid = 'FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
11+
fleet_service = client.preview.deployed_devices.fleets(fleet_sid)
12+
13+
device = fleet_service.devices("THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")\
14+
.fetch()
15+
16+
print(device)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Get the Node helper library from https://twilio.com/docs/libraries/java
2+
import com.twilio.Twilio;
3+
import com.twilio.base.ResourceSet;
4+
import com.twilio.rest.preview.deployedDevices.fleet;
5+
import java.io.IOException;
6+
import java.nio.file.Files;
7+
import java.nio.file.Paths;
8+
9+
public class Example {
10+
// Get your Account SID and Auth Token from https://twilio.com/console
11+
public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
12+
public static final String AUTH_TOKEN = "your_auth_token";
13+
14+
public static void main(String[] args) {
15+
Twilio.init(ACCOUNT_SID, AUTH_TOKEN);
16+
17+
String fleetSid = "FLXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
18+
String deviceSid = "THXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
19+
Device device = DeviceFetcher(fleetSid, deviceSid);
20+
21+
System.out.println(device.getSid());
22+
}
23+
}

0 commit comments

Comments
 (0)