Skip to main content
Version: 24.05

Create a saved Drill report

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint​

/o?method=createReport

Overview​

Runs a Drill segmentation query and, for auto-refreshing reports, saves it as a task that is recalculated in the background with daily, weekly and monthly buckets over the last 732 days.

Without autoRefresh=true the request behaves like Query Segmentation - Read.

Authentication​

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions​

Requires drill Read permission.

Request Parameters​

All parameters of Query Segmentation - Read are accepted, with method set to createReport. The following control the saved report:

ParameterTypeRequiredDescription
autoRefreshStringNotrue to save the report as an auto-refreshing task. Period is then fixed to 732 days and the bucket is calculated for daily, weekly and monthly.
report_nameStringNoName of the report.
report_descStringNoDescription of the report.
period_descStringNoPeriod description stored with the report.
globalStringNotrue to make the report visible to other members.
manually_createStringNotrue when the report is created by hand.
task_idStringNoExisting task to update instead of creating a new one.
linked_toStringNoID of an item the report is linked to.
projectionKeyString or JSON String (Array)NoGroup-by field or fields. A saved auto-refresh report is only created when no group-by field is given; otherwise the request is processed as a plain segmentation query.

Examples​

Save an auto-refreshing report​

/o?method=createReport&
app_id=64f5c0d8f4f7ac0012ab3456&
event=[CLY]_session&
queryObject={}&
period=30days&
bucket=daily&
autoRefresh=true&
report_name=Weekly sessions

Response​

For an auto-refreshing report the response contains the ID of the created task:

{
"task_id": "17f0f6c3a2c42cbced96d4a01f88f9a7f45bc7a5"
}

Otherwise the response is the same as for Query Segmentation - Read.

Behavior​

  • The saved report is a background task linked to the member who created it.
  • After the task is created, the daily, weekly and monthly parts are calculated in the background and can be read through the Tasks endpoints.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.long_tasksTask metadata storageStores the saved report and its daily, weekly and monthly parts.
countly_drill.drill_eventsDrill event dataSource of the report data.