Drill - Create Report
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 as a report. With autoRefresh=true and no projectionKey, a report task is created that is calculated for daily, weekly and monthly buckets over 732 days. Otherwise the request is handled 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
The query parameters of Query Segmentation - Read (projectionKey, list, limit, and so on) are also accepted.
| Parameter | Type | Required | Description |
|---|---|---|---|
method | String | Yes | Must be createReport. |
app_id | String | Yes | Target app ID. |
event | String | Yes | Event key to query. |
queryObject | JSON String (Object) | Yes | Mongo-style Drill filter object. Use {} for no additional filters. |
period | String or Array | Conditional | Required unless autoRefresh is true. Same values as in Query Segmentation - Read. |
bucket | String or JSON String (Array) | Conditional | Required unless autoRefresh is true. hourly, daily, weekly, or monthly. |
autoRefresh | String | No | true creates an auto-refreshing report. period and period_desc are then set to 732days and bucket is cleared. |
report_name | String | No | Name of the report. |
report_desc | String | No | Description of the report. |
period_desc | String | No | Period description stored with the report. |
global | String | No | true makes the report global. |
manually_create | String | No | true marks the report as created manually. |
linked_to | String | No | ID the report is linked to. |
task_id | String | No | Existing report task ID. |
projectionKey | String or JSON String (Array) | No | Group-by field or fields. A one-element array is treated as a single field; an empty array is ignored. |
api_key | String | Conditional | Required if auth_token is not provided. |
auth_token | String | Conditional | Required if api_key is not provided. |
Examples
Create an auto-refreshing report
/o?method=createReport&
app_id=64f5c0d8f4f7ac0012ab3456&
api_key=YOUR_API_KEY&
event=[CLY]_session&
queryObject={}&
autoRefresh=true&
report_name=Sessions
Response
Success Response
For an auto-refreshing report without projectionKey, the response contains the ID of the report task:
{
"task_id": "65f1f7b2ad5b9b001f12ab34"
}
In all other cases the response has the same shape as Query Segmentation - Read.
Error Responses
See Query Segmentation - Read for the validation errors of the query parameters.
Behavior
- With
autoRefresh=trueand noprojectionKey, the report is created as a task group with daily, weekly and monthly sub-reports, each calculated over 732 days.