Export data using custom SQL queries with dynamic parameters. This endpoint allows you to execute pre-configured SQL queries with customizable parameters that replace placeholders in the query.
{limit}
, {offset}
, {customerId}
{
"label": "Customer Events Report",
"sqlQuery": "SELECT id, type, createdAt FROM event WHERE customerId = {customerId} ORDER BY id DESC LIMIT {limit} OFFSET {offset}",
"parameters": [
{
"key": "customerId",
"label": "Customer ID",
"description": "The customer to export events for",
"defaultValue": null
},
{
"key": "limit",
"label": "Limit",
"description": "Maximum number of records to return",
"defaultValue": "100"
},
{
"key": "offset",
"label": "Offset",
"description": "Number of records to skip",
"defaultValue": "0"
}
]
}
GET /api/mind/export/customData?exportId=0&format=json&customerId=12345&limit=50&offset=0
This would execute:
SELECT id, type, createdAt FROM event WHERE customerId = ? ORDER BY id DESC LIMIT ? OFFSET ?
With parameters: [12345, 50, 0]
Cookie-based authentication
The format of the export
xlsx
, csv
, json
The ID of the export configuration to use. This corresponds to the index in the
customDataExports
settings array. If null, the default export as configured
in the customDataExportSelected
setting will be used.
Dynamic parameters that replace placeholders in the SQL query.
Any parameter defined in the export configuration can be overridden via GET parameters. Parameter names should match the placeholders in the SQL query (without the curly braces).
Parameter Resolution Logic:
Common Parameter Examples:
limit=100
→ replaces {limit}
placeholderoffset=0
→ replaces {offset}
placeholdercustomerId=12345
→ replaces {customerId}
placeholderstartDate=2024-01-01
→ replaces {startDate}
placeholderendDate=2024-12-31
→ replaces {endDate}
placeholderstatus=active
→ replaces {status}
placeholderdepartmentId=5
→ replaces {departmentId}
placeholderSuccessful operation
The response is of type object[]
.