Skip to main content
Version: 25.03

Drill - Create 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 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.

ParameterTypeRequiredDescription
methodStringYesMust be createReport.
app_idStringYesTarget app ID.
eventStringYesEvent key to query.
queryObjectJSON String (Object)YesMongo-style Drill filter object. Use {} for no additional filters.
periodString or ArrayConditionalRequired unless autoRefresh is true. Same values as in Query Segmentation - Read.
bucketString or JSON String (Array)ConditionalRequired unless autoRefresh is true. hourly, daily, weekly, or monthly.
autoRefreshStringNotrue creates an auto-refreshing report. period and period_desc are then set to 732days and bucket is cleared.
report_nameStringNoName of the report.
report_descStringNoDescription of the report.
period_descStringNoPeriod description stored with the report.
globalStringNotrue makes the report global.
manually_createStringNotrue marks the report as created manually.
linked_toStringNoID the report is linked to.
task_idStringNoExisting report task ID.
projectionKeyString or JSON String (Array)NoGroup-by field or fields. A one-element array is treated as a single field; an empty array is ignored.
api_keyStringConditionalRequired if auth_token is not provided.
auth_tokenStringConditionalRequired 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=true and no projectionKey, the report is created as a task group with daily, weekly and monthly sub-reports, each calculated over 732 days.