From d08f6140e09b4c10b0ca8783c50892bee96fc1f2 Mon Sep 17 00:00:00 2001 From: rijkvanzanten Date: Tue, 25 May 2021 14:40:24 -0400 Subject: [PATCH] Document new aggregate/group endpoint --- docs/reference/api/query.md | 109 ++++++++++++++++++++---------------- 1 file changed, 62 insertions(+), 47 deletions(-) diff --git a/docs/reference/api/query.md b/docs/reference/api/query.md index bdf1138466..6a60658c7f 100644 --- a/docs/reference/api/query.md +++ b/docs/reference/api/query.md @@ -20,10 +20,9 @@ pageClass: page-reference - [Sort](#sort) - [Limit](#limit) - [Offset](#offset) / [Page](#page) +- [Group](#group) +- [Aggregate](#aggregate) (sum/avg/min/max/count) - [Deep](#deep) -- [Metadata](#metadata) - - [Total Count](#total-count) - - [Filter Count](#filter-count) - [Export](#export) @@ -444,6 +443,66 @@ query { --- +## Group + +
+
+ +Group allows you to group the output items based on (a) shared value(s). + +
+
+ +### REST API + +``` +?group=year +?group=year,status +``` + +### GraphQL + +TBD + +
+
+ +--- + +## Aggregate + +
+
+ +Aggregate allows you to retrieve the output of several functions in your items. In the syntax listed to the right, +`` is one of `avg`, `sum`, `min`, `max`, or `count`, `` is the column you'd like to run the function on, +and `` is how the result should be returned. + +
+
+ +### REST API + +``` +?aggregate[][]= +``` + +##### Example + +``` +?aggregate[avg][price]=average_sale +&aggregate[sum][price]=revenue +``` + +### GraphQL + +TBD + +
+
+ +--- + ## Deep
@@ -518,50 +577,6 @@ query { --- -## Metadata - -
-
- -Metadata allows you to retrieve some additional information about the items in the collection you're fetching. `*` can -be used as a wildcard to retrieve all metadata. - -
-
- -
-
- -### Total Count - -Returns the total item count of the collection you're querying. - -### Filter Count - -Returns the item count of the collection you're querying, taking the current filter/search parameters into account. - -
-
- -### REST API - -``` -?meta=total_count - -?meta=filter_count - -?meta=* -``` - -### GraphQL - -n/a - -
-
- ---- - ## Export Save the current API response to a file.