Use the
groupby request parameter to group specified values and apply the aggregate function
@sum to each group. The
groupby parameter works like an SQL Group By clause.
NOTE You can use
@sum without the
groupby parameter, if you are grouping by the
id attribute of a resource.
Syntax
As the first parameter on the request URI:
?groupby=<groupby_expr>
As a subsequent parameter on the request URI:
&groupby=<groupby_expr>
where
<groupby_expr> is defined by the following syntax using Backus-Naur Form (BNF):
In the syntax for
<groupby_expr>,
prop_expr is the name of an attribute. Its type can be
int,float,
string, InetSocketAddress,
Date,
Boolean,
Enum, or a list whose element is among the above types.
NOTE You can use dot notation syntax (resource_type.attribute) in a
groupby expression to group the response data by attributes from a related resource type. A related resource type is a resource type that is either referred to explicitly in the definition of the target resource type or embedded in the target resource type.
Example - Summarizing the size and rawSize of drives grouped by drive type
The following request returns a summary of size and rawSize of drives based on the type to which they belong.
Header
Accept: application/json
Content-Type: application/json
Request
GET https://10.108.53.216/api/types/disk/instances?fields=diskTechnology,abc::@sum(size),def::@sum(rawSize)&groupby=diskTechnology"&compact=true