Enneo

Export

Export custom client reports

GET /export/customData

GET /export/customData

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.

This endpoint should only be used if standard export endpoints (for tickets, messages, worklog, survey, etc.) do not suffice. It is an adanced feature and every query requires prior approval by your Enneo account manager.

How Parameters Work

  1. SQL Query Placeholders: Custom exports contain SQL queries with placeholders like {limit}, {offset}, {customerId}
  2. Parameter Resolution: Parameters are resolved in this order:
    • GET query parameters (highest priority)
    • Default values from export configuration
    • Required parameters will throw an error if missing
  3. Security: All parameters are safely bound using prepared statements

Example Custom Export Configuration

{
  "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"
    }
  ]
}

Example Usage

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]

Query parameters

formatenumquery

The format of the export

exportIdintegerquery

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.

{parameterName}stringquery

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:

  1. If provided as GET parameter → use that value
  2. If not provided but has default value → use default value
  3. If not provided and no default → throw error (parameter required)

Common Parameter Examples:

  • limit=100 → replaces {limit} placeholder
  • offset=0 → replaces {offset} placeholder
  • customerId=12345 → replaces {customerId} placeholder
  • startDate=2024-01-01 → replaces {startDate} placeholder
  • endDate=2024-12-31 → replaces {endDate} placeholder
  • status=active → replaces {status} placeholder
  • departmentId=5 → replaces {departmentId} placeholder

Responses

200 — Successful operation

Response Example

[
  {
    "id": 1,
    "type": "login",
    "createdAt": "2024-01-15T10:30:00Z",
    "customerId": 12345
  },
  {
    "id": 2,
    "type": "purchase",
    "createdAt": "2024-01-14T15:45:00Z",
    "customerId": 12345
  }
]

400 — Bad request - required parameter missing or invalid export configuration

403 — Unauthorized

500 — Internal server error