Query API

Overview

Almost all data shown within the Calq reporting interface can be queried remotely using the Query API and AQL. The API is queried using simple HTTP(s) requests in the following format:

http://api.calq.io/query?aql=<aql>&format=<format>&read_key=<read_key>
aql Required The AQL query that specifies the data to fetch.
read_key Required The read key for the project being queried.
format Optional An optional formatter for the query result (see below). If not specified the default is json.

For example:

http://api.calq.io/query?aql=SELECT+COUNT(*)+FROM+%24all+PERIOD+%272014-10-06+00%3A00%3A00%27+TO+%272014-11-04+23%3A59%3A59%27+BUCKET+DAY&format=json&read_key=bfff14a4e0225789be3d9d22c4bb42a1

Formatters

Calq has a range of formatters available depending on the type of query used. Different types of query support different formatters. If no format parameter is specified then the default format of json is used.

The default json formatter renders time series data in a format suitable for D3.js.

Formatter Time series Funnel (Conversion) Funnel (Users) Retention People
json Y Y N Y Y
json_chartjs Y N N N N
csv Y Y Y N N

Issuing a query with an incompatible formatter will result in an error being returned.