Get List of available Clients

Get a list of available clients

The command below shows all Clients created using the default Admin Account

CURL
NodeJS
Python
Java
CURL
curl -X GET https://api.teleapi.net/call/2012-04-24/Accounts/ACCOUNT_SID/Clients.json \
-u 'teleapi-Token'
NodeJS
const request = require('request');
โ€‹
// Provide your Account Sid and Auth Token from your Console Account page
const ACCOUNT_SID = 'my_ACCOUNT_SID';
const AUTH_TOKEN = 'my_AUTH_TOKEN';
โ€‹
request({
method: 'GET',
url: 'https://api.teleapi.net/call/2012-04-24/Accounts/' + ACCOUNT_SID + '/Clients.json',
auth: { 'user': ACCOUNT_SID, 'pass': AUTH_TOKEN }
},
function (error, response, body) {
// Add your business logic below; status can be found at 'response.statusCode' and response body at 'body'
...
}
);
Python
from http.client import HTTPSConnection
from base64 import b64encode
โ€‹
# Provide your Account Sid and Auth Token from your Console Account page
ACCOUNT_SID = 'my_ACCOUNT_SID'
AUTH_TOKEN = 'my_AUTH_TOKEN'
โ€‹
userAndPass = b64encode(bytes(ACCOUNT_SID + ':' + AUTH_TOKEN, 'utf-8')).decode("ascii")
headers = { 'Authorization' : 'Basic %s' % userAndPass }
โ€‹
conn = HTTPSConnection('api.teleapi.net')
conn.request("GET", '/call/2012-04-24/Accounts/' + ACCOUNT_SID + '/Clients.json',
headers=headers)
res = conn.getresponse()
โ€‹
# Add your business logic below; status can be found at 'res.status', reason at 'res.reason' and response body can be retrieved with res.read()
...
Java
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.util.Base64;
โ€‹
public class JavaSampleClass {
// Provide your Account Sid and Auth Token from your Console Account page
public static final String ACCOUNT_SID = "my_ACCOUNT_SID";
public static final String AUTH_TOKEN = "my_AUTH_TOKEN";
โ€‹
โ€‹
public static void main(String[] args) throws Exception {
String userAndPass = ACCOUNT_SID + ':' + AUTH_TOKEN;
String encoded = Base64.getEncoder().encodeToString(userAndPass.getBytes());
โ€‹
URL url = new URL("https://api.teleapi.net/call/2012-04-24/Accounts/" + ACCOUNT_SID + "/Clients.json");
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection();
conn.setRequestProperty("Authorization", "Basic " + encoded);
conn.setRequestMethod("GET");
โ€‹
// Add your business logic below; response code can be obtained from 'conn.getResponseCode()' and input stream from 'conn.getInputStream()'
...
}
}

JSON GET Response

[
{
"sid": "CL3003328d0de04ba68f38de85b732ed56",
"date_created": "Mon, 4 Nov 2013 16:33:39 -0500",
"date_updated": "Mon, 4 Nov 2013 16:33:39 -0500",
"account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
"api_version": "2012-04-24",
"friendly_name": "bob",
"login": "bob",
"password": "i-1c8468a2",
"status": "1",
"voice_method": "POST",
"voice_fallback_method": "POST",
"uri": "/call/2012-04-24/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Clients/CL3003328d0de04ba68f38de85b732ed56.json"
},
{
"sid": "CLa2b99142e111427fbb489c3de357f60a",
"date_created": "Mon, 4 Nov 2013 12:52:44 -0500",
"date_updated": "Mon, 4 Nov 2013 12:52:44 -0500",
"account_sid": "ACae6e420f425248d6a26948c17a9e2acf",
"api_version": "2012-04-24",
"friendly_name": "alice",
"login": "alice",
"password": "i-1c8468a2",
"status": "1",
"voice_method": "POST",
"voice_fallback_method": "POST",
"uri": "/call/2012-04-24/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Clients/CLa2b99142e111427fbb489c3de357f60a.json"
}
]

โ€‹