V3 Charts
Preview a chart
Changed onRuns an unsaved chart and returns its rows, so a caller can check it shows what was meant before saving it. Saves nothing. The chart query is checked by the chart query validator first: a field outside the catalog, a refused Cube option, a timezone, a bound exceeded or an invalid date range answers 422 naming each problem in invalid_params. On a chart grouped by time alone, a date range wider than 10,000 buckets of its granularity is one such bound (limit_exceeded).
Needs read access to the workspace and the Feedback Dataset. Counts against the chart-query budget (600 per minute, 20 at once, per user or API key), not the v3 default.
post/api/v3/charts/preview
Request
- Base URLhttps://app.formbricks.com
- URLhttps://app.formbricks.com/api/v3/charts/preview
- Auth
- API key in cookie next-auth.session-token
- or API key in header x-api-key
- or HTTP bearer
Request body
Example request
{
"query": {
"measures": [
"FeedbackRecords.npsScore"
],
"dimensions": [
"FeedbackRecords.sourceName"
],
"timeDimensions": [
{
"dimension": "FeedbackRecords.collectedAt",
"dateRange": "last 30 days"
}
],
"filters": [
{
"member": "FeedbackRecords.sourceType"
}
]
},
"dateRange": "last 7 days"
}Response
The chart's rows
Example response
{
"data": {
"rows": [
{
"FeedbackRecords.sourceName": "Web",
"FeedbackRecords.count": 42
}
]
}
}Changes
- info
endpoint added
- info