You are here

REST API summarizations, aggregations and groupings

Subscribe to Syndicate
You can summarize the data based on fields which requires a group= parameter followed by an agg= parameters indicating the fields you want to summarize by and how you want to summarize them. For example:

group=round(date_bought,1,month):purchase_date&agg=count+sum(total_cost)+avg(total_cost)

The group= allows you to summarize by text, number, boolean and date fields. You can also provide a function to summarize by parts of a date field.

Examples of the group= clause:

  • group=last_name - group patrons for summary by last name
  • group=company+last_name - group patrons for summarization by company and last name
  • group=date_bought - group the tickets by ticket the date they were bought - which may be of limited use as it contains time stamp
  • group=round(date_bought,1,month):purchase_date - group the tickets by date bought, but rounded to monthly increments. You can change a date grouping to be rounded to any interval, like 10 minute intervals

Examples of the agg= clause:

Query Breakdown:

Params are broken up by the ampersand &

  • Only sold tickets: q=-date_bought:null
  • Group by the purchase month: group=round(date_bought, 1, month)
  • Name it purchase_date
  • For each group aggregate the count of tickets, the total cost of tickets, and the average cost of each ticket: agg=count+sum(total_cost)+avg(total_cost)

Examples