Knowledge aggregates query returning empty results

Hi all,

The dashboard for knowledge articles is showing zero data for last week. It’s weird because the articles are active. Tried calling POST /api/v2/analytics/knowledge/aggregates/query but the response is empty. Maybe the interval is wrong.

{
 "interval": "2024-05-01T00:00:00Z/2024-05-07T23:59:59Z",
 "groupBy": [
 "knowledge.article.id"
 ],
 "metrics": [
 "nContacted"
 ]
}

The result comes back with 200 OK but no data in the results array.

1 Like

The synchronous /api/v2/analytics/knowledge/aggregates/query endpoint often returns empty arrays if the dataset is too large for a real-time response. Switch to the async flow.

Use POST /api/v2/analytics/knowledge/aggregates/jobs to trigger the export, poll the status via /api/v2/analytics/knowledge/aggregates/jobs/{jobId}, then fetch the actual data using the /results endpoint with the cursor for pagination. It’s the only way to ensure you don’t hit a timeout or truncation.