Summarize collection rows
/collection/{id}/aggregate
Path Parameters
Resource id
Request Body
A text or select group puts NULL and the empty string in one group whose key is null.
dayweekmonthquarteryear
"choices" (select fields only, 400 on any other): groups come in the field's declared choice order, then values that are no longer choices (alphabetical), then the empty group. "value" (any field): by the key, the empty group last in both directions; sort { by: , direction } sets the direction. Absent: by key, ascending unless sort says otherwise, with the empty group sorting as the lowest key.
choicesvalue
Response Body
curl -X POST 'https://api.elaichi.ai/collection/<id>/aggregate' \
-H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
-H 'Content-Type: application/json' \
-d '{"group_by":[],"metrics":[],"q":"your_q","limit":0,"cursor":"your_cursor"}'const body = {
"group_by": [],
"metrics": [],
"q": "your_q",
"limit": 0,
"cursor": "your_cursor"
};
const response = await fetch('https://api.elaichi.ai/collection/<id>/aggregate', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
const data = await response.json();
console.log(data);import os
import requests
url = "https://api.elaichi.ai/collection/<id>/aggregate"
headers = {
"Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
"Content-Type": "application/json",
}
payload = {
"group_by": [],
"metrics": [],
"q": "your_q",
"limit": 0,
"cursor": "your_cursor"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())