Use saved reports in your own dashboards
Build and save a report in TestCollab, then fetch its aggregated results from your integration. You do not need to recreate its definition in code.
Prepare a report
Section titled “Prepare a report”Open an existing report that the token owner can access and copy its report ID. A report shared with a project can be used by that project’s members. A private report remains limited to its owner; project sharing does not mean anonymous internet access.
Fetch its results
Section titled “Fetch its results”import { createConfiguration, ReportTemplatesApi } from '@testcollab/sdk';
const api = new ReportTemplatesApi(createConfiguration(process.env.TESTCOLLAB_TOKEN!));const report = await api.getReportTemplateResults({ id: 123, // A saved report you can access in TestCollab. dateFrom: '2026-10-01', dateTo: '2026-10-19',});
console.log('Matching source records:', report.totalRows);for (const row of report.rows) { console.log(JSON.stringify(row));}// Use report.dimensions and report.metrics to interpret the row columns.Omit both dates to use the report’s saved window. When overriding the window, send dateFrom and dateTo together. The window cannot span more than 365 days.
Interpret the response
Section titled “Interpret the response”| Field | Use |
|---|---|
dimensions |
Describes the grouping columns in each row |
metrics |
Describes the measured values in each row |
rows |
The aggregated result rows |
totalRows |
Matching source records before grouping, not the length of the rows array |
Treat the dimension and metric metadata as the description of the columns. Do not assume that every report has the same row keys.
Schedule an extract
Section titled “Schedule an extract”Run the script in your own scheduler with a token stored as a secret. Save the result to the destination your workflow uses, and keep its collection time and report window alongside the data.
See the method reference for parameters and errors.