Get Analytics
curl --request POST \
--url https://api.trieve.ai/api/analytics \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '
{
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": true
}
],
"table": "search_queries",
"cte_query": {
"alias": "<string>",
"query": {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": true
}
],
"table": "search_queries",
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": [
"<string>"
],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": {
"columns": [
"<string>"
]
}
}
},
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": [
"<string>"
],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": {
"columns": [
"<string>"
]
}
}
'import requests
url = "https://api.trieve.ai/api/analytics"
payload = {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": True
}
],
"table": "search_queries",
"cte_query": {
"alias": "<string>",
"query": {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": True
}
],
"table": "search_queries",
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": ["<string>"],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": { "columns": ["<string>"] }
}
},
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": ["<string>"],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": { "columns": ["<string>"] }
}
headers = {
"TR-Dataset": "<tr-dataset>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'TR-Dataset': '<tr-dataset>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
columns: [{name: '<string>', alias: '<string>', distinct: true}],
table: 'search_queries',
cte_query: {
alias: '<string>',
query: {
columns: [{name: '<string>', alias: '<string>', distinct: true}],
table: 'search_queries',
expressions: [{expression: {name: '<string>', type: 'column'}, alias: '<string>'}],
filter_conditions: [
{
column: '<string>',
value: '<string>',
and_filter: '<array>',
or_filter: '<array>'
}
],
group_by: {
columns: ['<string>'],
having: {column: '<string>', type: 'aggregate', value: '<string>'}
},
joins: [
{
condition: {left_column: '<string>', right_column: '<string>', type: 'column_equals'},
table: 'search_queries'
}
],
limit: 1,
offset: 1,
order_by: {columns: ['<string>']}
}
},
expressions: [{expression: {name: '<string>', type: 'column'}, alias: '<string>'}],
filter_conditions: [
{
column: '<string>',
value: '<string>',
and_filter: '<array>',
or_filter: '<array>'
}
],
group_by: {
columns: ['<string>'],
having: {column: '<string>', type: 'aggregate', value: '<string>'}
},
joins: [
{
condition: {left_column: '<string>', right_column: '<string>', type: 'column_equals'},
table: 'search_queries'
}
],
limit: 1,
offset: 1,
order_by: {columns: ['<string>']}
})
};
fetch('https://api.trieve.ai/api/analytics', 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://api.trieve.ai/api/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'columns' => [
[
'name' => '<string>',
'alias' => '<string>',
'distinct' => true
]
],
'table' => 'search_queries',
'cte_query' => [
'alias' => '<string>',
'query' => [
'columns' => [
[
'name' => '<string>',
'alias' => '<string>',
'distinct' => true
]
],
'table' => 'search_queries',
'expressions' => [
[
'expression' => [
'name' => '<string>',
'type' => 'column'
],
'alias' => '<string>'
]
],
'filter_conditions' => [
[
'column' => '<string>',
'value' => '<string>',
'and_filter' => '<array>',
'or_filter' => '<array>'
]
],
'group_by' => [
'columns' => [
'<string>'
],
'having' => [
'column' => '<string>',
'type' => 'aggregate',
'value' => '<string>'
]
],
'joins' => [
[
'condition' => [
'left_column' => '<string>',
'right_column' => '<string>',
'type' => 'column_equals'
],
'table' => 'search_queries'
]
],
'limit' => 1,
'offset' => 1,
'order_by' => [
'columns' => [
'<string>'
]
]
]
],
'expressions' => [
[
'expression' => [
'name' => '<string>',
'type' => 'column'
],
'alias' => '<string>'
]
],
'filter_conditions' => [
[
'column' => '<string>',
'value' => '<string>',
'and_filter' => '<array>',
'or_filter' => '<array>'
]
],
'group_by' => [
'columns' => [
'<string>'
],
'having' => [
'column' => '<string>',
'type' => 'aggregate',
'value' => '<string>'
]
],
'joins' => [
[
'condition' => [
'left_column' => '<string>',
'right_column' => '<string>',
'type' => 'column_equals'
],
'table' => 'search_queries'
]
],
'limit' => 1,
'offset' => 1,
'order_by' => [
'columns' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"TR-Dataset: <tr-dataset>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trieve.ai/api/analytics"
payload := strings.NewReader("{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TR-Dataset", "<tr-dataset>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trieve.ai/api/analytics")
.header("TR-Dataset", "<tr-dataset>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trieve.ai/api/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TR-Dataset"] = '<tr-dataset>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyAnalytics
Get Analytics
This route allows you to view the analytics for a dataset using a structured query.
POST
/
api
/
analytics
Get Analytics
curl --request POST \
--url https://api.trieve.ai/api/analytics \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '
{
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": true
}
],
"table": "search_queries",
"cte_query": {
"alias": "<string>",
"query": {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": true
}
],
"table": "search_queries",
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": [
"<string>"
],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": {
"columns": [
"<string>"
]
}
}
},
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": [
"<string>"
],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": {
"columns": [
"<string>"
]
}
}
'import requests
url = "https://api.trieve.ai/api/analytics"
payload = {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": True
}
],
"table": "search_queries",
"cte_query": {
"alias": "<string>",
"query": {
"columns": [
{
"name": "<string>",
"alias": "<string>",
"distinct": True
}
],
"table": "search_queries",
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": ["<string>"],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": { "columns": ["<string>"] }
}
},
"expressions": [
{
"expression": {
"name": "<string>",
"type": "column"
},
"alias": "<string>"
}
],
"filter_conditions": [
{
"column": "<string>",
"value": "<string>",
"and_filter": "<array>",
"or_filter": "<array>"
}
],
"group_by": {
"columns": ["<string>"],
"having": {
"column": "<string>",
"type": "aggregate",
"value": "<string>"
}
},
"joins": [
{
"condition": {
"left_column": "<string>",
"right_column": "<string>",
"type": "column_equals"
},
"table": "search_queries"
}
],
"limit": 1,
"offset": 1,
"order_by": { "columns": ["<string>"] }
}
headers = {
"TR-Dataset": "<tr-dataset>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'TR-Dataset': '<tr-dataset>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
columns: [{name: '<string>', alias: '<string>', distinct: true}],
table: 'search_queries',
cte_query: {
alias: '<string>',
query: {
columns: [{name: '<string>', alias: '<string>', distinct: true}],
table: 'search_queries',
expressions: [{expression: {name: '<string>', type: 'column'}, alias: '<string>'}],
filter_conditions: [
{
column: '<string>',
value: '<string>',
and_filter: '<array>',
or_filter: '<array>'
}
],
group_by: {
columns: ['<string>'],
having: {column: '<string>', type: 'aggregate', value: '<string>'}
},
joins: [
{
condition: {left_column: '<string>', right_column: '<string>', type: 'column_equals'},
table: 'search_queries'
}
],
limit: 1,
offset: 1,
order_by: {columns: ['<string>']}
}
},
expressions: [{expression: {name: '<string>', type: 'column'}, alias: '<string>'}],
filter_conditions: [
{
column: '<string>',
value: '<string>',
and_filter: '<array>',
or_filter: '<array>'
}
],
group_by: {
columns: ['<string>'],
having: {column: '<string>', type: 'aggregate', value: '<string>'}
},
joins: [
{
condition: {left_column: '<string>', right_column: '<string>', type: 'column_equals'},
table: 'search_queries'
}
],
limit: 1,
offset: 1,
order_by: {columns: ['<string>']}
})
};
fetch('https://api.trieve.ai/api/analytics', 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://api.trieve.ai/api/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'columns' => [
[
'name' => '<string>',
'alias' => '<string>',
'distinct' => true
]
],
'table' => 'search_queries',
'cte_query' => [
'alias' => '<string>',
'query' => [
'columns' => [
[
'name' => '<string>',
'alias' => '<string>',
'distinct' => true
]
],
'table' => 'search_queries',
'expressions' => [
[
'expression' => [
'name' => '<string>',
'type' => 'column'
],
'alias' => '<string>'
]
],
'filter_conditions' => [
[
'column' => '<string>',
'value' => '<string>',
'and_filter' => '<array>',
'or_filter' => '<array>'
]
],
'group_by' => [
'columns' => [
'<string>'
],
'having' => [
'column' => '<string>',
'type' => 'aggregate',
'value' => '<string>'
]
],
'joins' => [
[
'condition' => [
'left_column' => '<string>',
'right_column' => '<string>',
'type' => 'column_equals'
],
'table' => 'search_queries'
]
],
'limit' => 1,
'offset' => 1,
'order_by' => [
'columns' => [
'<string>'
]
]
]
],
'expressions' => [
[
'expression' => [
'name' => '<string>',
'type' => 'column'
],
'alias' => '<string>'
]
],
'filter_conditions' => [
[
'column' => '<string>',
'value' => '<string>',
'and_filter' => '<array>',
'or_filter' => '<array>'
]
],
'group_by' => [
'columns' => [
'<string>'
],
'having' => [
'column' => '<string>',
'type' => 'aggregate',
'value' => '<string>'
]
],
'joins' => [
[
'condition' => [
'left_column' => '<string>',
'right_column' => '<string>',
'type' => 'column_equals'
],
'table' => 'search_queries'
]
],
'limit' => 1,
'offset' => 1,
'order_by' => [
'columns' => [
'<string>'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"TR-Dataset: <tr-dataset>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.trieve.ai/api/analytics"
payload := strings.NewReader("{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TR-Dataset", "<tr-dataset>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.trieve.ai/api/analytics")
.header("TR-Dataset", "<tr-dataset>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.trieve.ai/api/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TR-Dataset"] = '<tr-dataset>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"cte_query\": {\n \"alias\": \"<string>\",\n \"query\": {\n \"columns\": [\n {\n \"name\": \"<string>\",\n \"alias\": \"<string>\",\n \"distinct\": true\n }\n ],\n \"table\": \"search_queries\",\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n }\n },\n \"expressions\": [\n {\n \"expression\": {\n \"name\": \"<string>\",\n \"type\": \"column\"\n },\n \"alias\": \"<string>\"\n }\n ],\n \"filter_conditions\": [\n {\n \"column\": \"<string>\",\n \"value\": \"<string>\",\n \"and_filter\": \"<array>\",\n \"or_filter\": \"<array>\"\n }\n ],\n \"group_by\": {\n \"columns\": [\n \"<string>\"\n ],\n \"having\": {\n \"column\": \"<string>\",\n \"type\": \"aggregate\",\n \"value\": \"<string>\"\n }\n },\n \"joins\": [\n {\n \"condition\": {\n \"left_column\": \"<string>\",\n \"right_column\": \"<string>\",\n \"type\": \"column_equals\"\n },\n \"table\": \"search_queries\"\n }\n ],\n \"limit\": 1,\n \"offset\": 1,\n \"order_by\": {\n \"columns\": [\n \"<string>\"\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyAuthorizations
Headers
The dataset id or tracking_id to use for the request. We assume you intend to use an id if the value is a valid uuid.
Body
application/json
JSON request payload to filter the graph
Represents a complete Analytics query with parameters
Simple columns to select
Show child attributes
Show child attributes
table
Option 1 · enum<string>Option 2 · enum<string>Option 3 · enum<string>Option 4 · enum<string>Option 5 · enum<string>Option 6 · enum<string>Option 7 · enum<string>Option 8 · enum<string>Option 9 · enum<string>Option 10 · object
required
Available options:
search_queries Show child attributes
Show child attributes
Complex expressions to select
Show child attributes
Show child attributes
WHERE clause conditions
Show child attributes
Show child attributes
Represents a GROUP BY clause
Show child attributes
Show child attributes
Tables to join with
Show child attributes
Show child attributes
LIMIT clause
Required range:
x >= 0OFFSET clause
Required range:
x >= 0Show child attributes
Show child attributes
Response
200 - application/json
The analytics for the dataset
Was this page helpful?
⌘I