Preview a KPI configuration without persisting
POST
https://core.shopimind.com/v1/custom-stats/kpis/preview
Runs a one-shot SELECT query directly on the source for the last N days (default 7), returning a sample of computed rows. Useful to validate a KPI configuration before save.
Parameters
Header Parameters
spm-api-key*
[Authentication] Required API key.
Type
Requiredstring
Pattern
"^[a-zA-Z0-9-]{20,64}$"Request Body
application/json
JSON "name": { }, "description": { }, "source_type": "string", "source_schema_name": "orders", "relations_chain": [ [ "contacts" ] ], "measures": [ { "id_measure": "string", "type": "string", "field": "t.amount", "label": { }, "format": "number", "suffix": "string", "position": 0 } ], "dimensions": [ { "id_dimension": "string", "field": "t.status", "label": { }, "position": 0 } ], "time_field": "t.date_creation", "time_field_explicit": true, "filters": [ { "field": "t.amount", "operator": "string", "value": { } } ], "lookback_max_months": 12, "preview_days": 7
{
}
Responses
application/json
JSON "rows": [ "string" ], "rowCount": 0, "sql": "string", "previewDays": 0
{
}
Preview a KPI configuration without persisting Runs a one-shot SELECT query directly on the source for the last N days (default 7), returning a sample of computed rows. Useful to validate a KPI configuration before save. POST /v1/custom-stats/kpis/preview CustomKpiController_preview Custom KPIs spm-api-key [Authentication] Required API key. Client error - Invalid request or authentication issues Server error - Internal processing failure