Skip to main content

Group and total a register's rows.

POST/api/v1/custom-field-templates/{custom_field_template_id}/rows/aggregateregisters:read

The Portal's chart data over the register rows the caller can read: filter (eq, neq, gt, lt, gte, lte, between, in, contains; the values today, now, yesterday, tomorrow, this_week_start, this_month_start and this_year_start stand for dates), group by any number of fields, take metrics (count, sum, avg, min, max over a field), order and limit. Each answer group holds its value of every group_by field (by custom_field_id) and every metric (by name). owner narrows the rows to one document's.

Scoperegisters:read
AsynchronousNo
MCP toolaggregate_custom_field_template_rows
Portal permissionsview_custom_field_values

Parameters​

NameInTypeRequiredDescription
custom_field_template_idpathstringRequired
Docwize-Versionheaderstring (date)Optional

Request body​

Content typeType
application/jsonRegisterAggregateInput

Responses​

StatusDescriptionBody
200Success.application/json RegisterAggregateResult
400invalid_version, malformed_jsonapplication/problem+json Problem
401token_expired, unauthenticatedapplication/problem+json Problem
403forbidden, insufficient_scope, token_owner_inactiveapplication/problem+json Problem
404not_foundapplication/problem+json Problem
405method_not_allowedapplication/problem+json Problem
406not_acceptableapplication/problem+json Problem
413payload_too_largeapplication/problem+json Problem
415unsupported_media_typeapplication/problem+json Problem
421wrong_regionapplication/problem+json Problem
422validation_failedapplication/problem+json Problem
500internal_errorapplication/problem+json Problem
503tenant_unavailable, unavailableapplication/problem+json Problem
504timeoutapplication/problem+json Problem

Errors​

The problem codes this operation can answer with. Each code links to its page.

Schemas​

RegisterAggregateFilterInput​

FieldTypeRequiredDescription
custom_field_idstringRequired
operatorstringRequiredeq, neq, gt, lt, gte, lte, between, in or contains.
valuestring or nullOptionalThe value to compare with, as text: a number as decimal text, a date as YYYY-MM-DD (or today, now, yesterday, tomorrow, this_week_start, this_month_start, this_year_start). For every operator except in and between.
valuesarray of stringOptionalThe values for in (one or more) and between (exactly two: from, to), as value gives them.

RegisterAggregateGroup​

FieldTypeRequiredDescription
groupobjectRequiredThe group's value of each group_by field, keyed by the field's custom_field_id; null for rows with no value. Decimals are text, dates ISO text.
valuesobjectRequiredThe group's metrics, keyed by the metric's name. count is a number; the others are decimal text, or null when the group has no value.

RegisterAggregateInput​

FieldTypeRequiredDescription
filtersarray of RegisterAggregateFilterInputOptionalConditions every row must meet (all of them).
group_byarray of stringOptionalThe fields the rows are grouped by, in this order; none gives one group of every row.
limitinteger or nullOptionalThe most groups to answer; all of them when absent. has_more says whether more existed.
metricsarray of RegisterAggregateMetricInputOptionalWhat to total in each group; a count by default.
order_byarray of RegisterAggregateOrderInputOptionalThe order of the groups.
ownerRowOwnerWriteInput or nullOptionalOnly the rows of this document (type document); you must be able to read it.

RegisterAggregateMetricInput​

FieldTypeRequiredDescription
custom_field_idstring or nullOptionalThe field the function is taken over: required except for count, which counts the group's rows (with a field, the rows that have a value in it). sum and avg need a numeric field.
functionstringRequiredcount, sum, avg, min or max.
namestring or nullOptionalThe key the answer holds this metric's value under; the function's name by default. Names are unique in a request.

RegisterAggregateOrderInput​

FieldTypeRequiredDescription
custom_field_idstring or nullOptionalA field named in group_by.
directionstring or nullOptionalasc (the default) or desc.
metricstring or nullOptionalThe name of a metric. Exactly one of metric and custom_field_id.

RegisterAggregateResult​

FieldTypeRequiredDescription
groupsarray of RegisterAggregateGroupRequired
has_morebooleanRequiredWhether more groups existed beyond the limit.

RowOwnerWriteInput​

FieldTypeRequiredDescription
document_idstring or nullOptionalThe document's ID, for type document.
typestringRequireddocument (the only owner a row write takes).