Count, sum, average, min or max, optionally grouped
Count, sum, average, min or max over one object type, grouped by up to TWO dimensions. Answers 'how is the quarter going', 'pipeline by owner by quarter', 'pipeline by customer segment' and 'how many have no owner' in ONE call, with the database doing the arithmetic. Use this instead of paging records and adding them up yourself: it is one call rather than hundreds, and the number is computed rather than estimated. Filters use the same field:op:value language as the list tools. groupBy takes one dimension or an array of two, and a dimension written as hop.field crosses one declared relationship, so opportunity can group by company.industry. Dates must be bucketed to day, week, month, quarter or year, and quarter and year follow the workspace's own fiscal calendar, which the answer states. Too many groups is refused rather than truncated, and the cap applies to the PRODUCT of two dimensions, because a truncated total reads exactly like a real one. convertTo totals across currencies at a rate this workspace STORED and names the rate it used; a currency with no stored rate is refused rather than converted, because Indraft never invents one. For weighted pipeline, reduce the DERIVED field weighted_amount_minor: 'sum weighted_amount_minor where status is open' is your weighted pipeline in one call, computed by the database as amount times probability, and it obeys the currency rule exactly as the unweighted amount does. Derived fields can be reduced and not grouped by, because they are measures rather than dimensions. get_crm_schema lists the dimensions, the hops, the derived fields, the fiscal calendar and the stored rates.
Request
- Base URL: https://api.indraft.io
- URL: https://api.indraft.io/v1/aggregate
- Auth: HTTP bearer
Query parameters
What is being counted: a canonical type, or the key of a type this workspace defined.
The reduction. Count needs no field; the rest need one that carries a number.
The field to reduce. Refused when the function needs one and the field cannot carry it, rather than returning zero.
How to cut a date dimension: day, week, month or quarter. Required when grouping by a date, because a raw instant produces one group per record, which is a list wearing an aggregate's clothes.
Express the total in one currency. Refused unless this workspace has asserted a rate for every currency in the answer: Indraft never invents a rate, and a converted number nobody chose is worse than no number.
Which asserted rates to convert at. Absent means the latest, which is what a live report wants and what a historical one must not use.
Include archived rows. Off by default, because a list is what you are working on and history is somewhere you go deliberately.
A field to order by, with a leading minus for descending. Indexed fields only, for the same reason as filter.
Response
Success
Changes
No recorded changes to this operation across all 1 revision of this API.