Get session metadata from a poll
curl --request GET \
--url https://main.treble.ai/devapi/poll/{poll_id}/sessions \
--header 'Authorization: <authorization>'import requests
url = "https://main.treble.ai/devapi/poll/{poll_id}/sessions"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://main.treble.ai/devapi/poll/{poll_id}/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://main.treble.ai/devapi/poll/{poll_id}/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://main.treble.ai/devapi/poll/{poll_id}/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://main.treble.ai/devapi/poll/{poll_id}/sessions")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://main.treble.ai/devapi/poll/{poll_id}/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "dabcf6c0-8150-4231-bafd-a3c331da385f4",
"created_at": "2022-03-09 17:00:28.956422",
"finished_at": "2022-03-09 19:08:38.808986",
"user": {
"country_code": "+57",
"cellphone": "987654321"
}
},
{
"id": "dabcf6c0-8850-4231-bafd-a3c331da385f9",
"created_at": "2022-03-09 17:11:46.754945",
"finished_at": "2022-03-09 19:18:41.401605",
"user": {
"country_code": "+57",
"cellphone": "123456789"
}
}
],
"next_id": "da848b5f-27e2-49f9-8d31-313b791daf8d"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}API
Get all sessions
This endpoint, given a poll ID, returns the metadata of all sessions in a paginated manner. By default, it brings the first 1000 records from the current year. Optional parameters can be used to control the date range and pagination.
GET
/
devapi
/
poll
/
{poll_id}
/
sessions
Get session metadata from a poll
curl --request GET \
--url https://main.treble.ai/devapi/poll/{poll_id}/sessions \
--header 'Authorization: <authorization>'import requests
url = "https://main.treble.ai/devapi/poll/{poll_id}/sessions"
headers = {"Authorization": "<authorization>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: '<authorization>'}};
fetch('https://main.treble.ai/devapi/poll/{poll_id}/sessions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://main.treble.ai/devapi/poll/{poll_id}/sessions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://main.treble.ai/devapi/poll/{poll_id}/sessions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "<authorization>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://main.treble.ai/devapi/poll/{poll_id}/sessions")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://main.treble.ai/devapi/poll/{poll_id}/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"results": [
{
"id": "dabcf6c0-8150-4231-bafd-a3c331da385f4",
"created_at": "2022-03-09 17:00:28.956422",
"finished_at": "2022-03-09 19:08:38.808986",
"user": {
"country_code": "+57",
"cellphone": "987654321"
}
},
{
"id": "dabcf6c0-8850-4231-bafd-a3c331da385f9",
"created_at": "2022-03-09 17:11:46.754945",
"finished_at": "2022-03-09 19:18:41.401605",
"user": {
"country_code": "+57",
"cellphone": "123456789"
}
}
],
"next_id": "da848b5f-27e2-49f9-8d31-313b791daf8d"
}{
"error": "<string>",
"message": "<string>"
}{
"error": "<string>",
"message": "<string>"
}Headers
Authorization API Key. Can be obtained at https://app.treble.ai/en/dashboard/settings/developers
Path Parameters
ID of the poll from which you want to obtain the sessions
Query Parameters
Timestamp UNIX UTC for the start date of the range to query
Timestamp UNIX UTC for the end date of the range to query
Integer between 1 and 10,000 that indicates the number of sessions to recover
Required range:
1 <= x <= 10000Pagination cursor returned in the 'next_id' property of the previous response
Was this page helpful?