Get all of a project's accounts
Header Key | Description | Example |
---|---|---|
Authorization | The Authorization header for this endpoint. The value must be the token from the /v3/auth/tokens/get endpoint and given using the Bearer pattern. | Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdW... |
Name | Type | Description |
---|---|---|
projectId | string | The UUID of the project |
A successful response
Field Name | Type | Description |
---|---|---|
accounts | array<object> | The accounts in the project. |
curl \
-X GET "https://rest.eus.canaryspeech.com/v2/org/project/${PROJECT_ID}/get-accounts" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
function getV2OrgProjectGetAccounts() {
const projectId = 'abc123';
const url = `https://rest.eus.canaryspeech.com/v2/org/project/${projectId}/get-accounts`;
const headers = {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
fetch(url, {
method: 'GET',
headers: headers
}).then((response) => {
if (!response.ok) throw new Error(response.status);
return response.json()
}).then((json) => {
const { accounts } = json;
// ...
});
}
const https = require('https');
function getV2OrgProjectGetAccounts() {
const projectId = 'abc123';
const headers = {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
const options = {
hostname: 'rest.eus.canaryspeech.com',
port: 443,
path: `/v2/org/project/${projectId}/get-accounts`,
method: 'GET',
headers: headers
};
const request = https.request(options, (response) => {
if (response.statusCode !== 200) throw new Error(response.statusCode);
response.on('data', (d) => {
const { accounts } = JSON.parse(d);
// ...
});
});
request.on('error', (err) => {
throw new Error(err);
});
request.end();
}
const axios = require('axios').default;
async function getV2OrgProjectGetAccounts() {
const projectId = 'abc123';
const url = `https://rest.eus.canaryspeech.com/v2/org/project/${projectId}/get-accounts`;
const headers = {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
const response = await axios.get(url, { headers });
if (response.status !== 200) throw new Error(response.status);
const { accounts } = response.data;
// ...
}
import * as https from 'https';
function getV2OrgProjectGetAccounts(): void {
const projectId = 'abc123';
const headers = {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
const options = {
hostname: 'rest.eus.canaryspeech.com',
port: 443,
path: `/v2/org/project/${projectId}/get-accounts`,
method: 'GET',
headers: headers
};
const request = https.request(options, (response) => {
if (response.statusCode !== 200) throw new Error(response.statusCode);
response.on('data', (d) => {
const { accounts } = JSON.parse(d) as Record<string, unknown>;
// ...
});
});
request.on('error', (err) => {
throw new Error(err);
});
request.end();
}
import axios from 'axios';
async function getV2OrgProjectGetAccounts(): Promise<void> {
const projectId = 'abc123';
const url = `https://rest.eus.canaryspeech.com/v2/org/project/${projectId}/get-accounts`;
const headers = {
Authorization: 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
const response = await axios.get(url, { headers });
if (response.status !== 200) throw new Error(response.status);
const { accounts } = response.data;
// ...
}
import requests
def get_v2_org_project_get_accounts():
project_id = 'abc123'
url = f'https://rest.eus.canaryspeech.com/v2/org/project/{project_id}/get-accounts'
headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
}
response = requests.get(
url,
headers=headers,
)
if response.status_code !== 200:
raise Exception(response.status_code)
response_obj = response.json()
accounts = response_obj['accounts']
# ...
import org.json.simple.JSONObject;
import org.json.simple.JSONArray;
import org.json.simple.JSONParser;
import org.json.simple.JSONValue;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpRequest.BodyPublishers;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.nio.charset.StandardCharsets;
import java.util.List;
import java.util.Map;
public class CanarySpeechApi {
public void getV2OrgProjectGetAccounts() {
final String projectId = "abc123"
URI uri = new URI("https://rest.eus.canaryspeech.com/v2/org/project/" + projectId + "/get-accounts");
HttpRequest request = HttpRequest.newBuilder()
.uri(uri)
.version(HttpClient.Version.HTTP_2)
.header("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c")
.GET()
.build();
HttpClient client = HttpClient.newBuilder()
.version(HttpClient.Version.HTTP_1_1)
.build();
HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
if (client.status != 200) {
throw new Exception(client.status.toString());
}
JSONParser parser = new JSONParser();
JSONObject responseBody = (JSONObject) parser.parse(client.body());
List<Object> accounts = (List<Object>) responseBody.get("accounts");
// ...
}
}
import org.json.JSONObject
import java.lang.StringBuilder
import java.net.URL
import javax.net.ssl.HttpsURLConnection
suspend fun getV2OrgProjectGetAccounts() = runCatching {
val projectId = "abc123"
val url = URL.create("https://rest.eus.canaryspeech.com/v2/org/project/"${projectId}"/get-accounts")
with(url.openConnection() as HttpsURLConnection) {
requestMethod = "GET"
instanceFollowRedirects = true
setRequestProperty("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c")
doOutput = true
if (responseCode != 200) throw Error(responseMessage)
val buffer = StringBuilder()
var line: String?
inputStream.bufferedReader(Charsets.UTF-8).use {
do {
line = it.readLine()
if (line != null) buffer.appendLine(line)
} while (line != null)
}
val responseBody = JSONObject(buffer.toString())
val accounts = responseBody.get("accounts") as Array<Object>
// ...
}
}
import UIKit
func getV2OrgProjectGetAccounts() -> void {
let projectId = "abc123"
let url = URL("https://rest.eus.canaryspeech.com/v2/org/project/\(projectId)/get-accounts")
let headers: [String: String] = [
"Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"
]
var request = URLRequest(url: url)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
let task = URLSession.shared.dataTask(with: request) { data, response, error in
guard
let data = data,
let response = response as? HTTPURLResponse,
error == nil
else {
print("error", error ?? URLError(.badServerResponse)
return
}
guard (200 ... 299) ~= response.statusCode else {
print("statusCode = \(response.statusCode)")
print("response = \(response)")
return
}
do {
let responseObj = try JSONDecoder().decode(GetV2OrgProjectGetAccountsResponse.self, data)
// ...
} catch {
print(error)
}
}
}
}
struct GetV2OrgProjectGetAccountsResponse: Decodable {
let accounts: [undefined]
}
using System.Collections.Generic;
using System.Net.Http;
using System.Text.Encoding;
using System.Text.Json;
using System.Text.Json.Serialization;
public static class CanarySpeechAPI
{
public static readonly HttpClient client = new HttpClient();
public static async Task getV2OrgProjectGetAccounts()
{
var projectId = "abc123";
var url = "https://rest.eus.canaryspeech.com/v2/org/project/${projectId}/get-accounts\"";
var request = new HttpRequestMessage(HttpMethod.Get, url);
request.Headers.Add("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
var responseBody = await response.Content.ReadAsStringAsync();
var responseJson = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(responseBody);
var accounts = (List<undefined>)responseJson["accounts"];
// ...
}
}
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> function getV2OrgProjectGetAccounts() async {
final projectId = 'abc123';
final uri = Uri.https('rest.eus.canaryspeech.com', 'v2/org/project/$projectId/get-accounts', queryParams);
final headers = {
'Authorization': 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
};
final request = http.Request('GET', uri);
request.headers.addAll(headers)
final client = http.Client();
try {
final responseStream = await client.send(request);
final statusCode = responseStream.statusCode;
if (statusCode < 200 || statusCode >= 300) {
throw Error(statusCode.toString());
}
final responseBytes = await responseStream.stream.toBytes();
final responseString = utf8.decode(responseBytes);
final response = json.decode(responseString);
final accounts = response['accounts'] as List<dynamic>;
// ...
} catch (e) {
print(e);
}
}
Name | Type | Description |
---|---|---|
uuid | string | |
name | string | |
status | int32 | |
dateCreated | date-time | |
extraData | object |