Comment on page
Get groups of entities
Sometimes instead of just listing entities, you want to group them into facets, and count how many entities are in each group. For example, maybe you want to count the number of
Worksby open access status. To do that, you call the entity endpoint, adding the
This returns a
metaobject with details about the query, and a
group_byobject with the groups you've asked for:
So from this we can see that the majority of works (202,814,957 of them) are type
article, with another 21,250,659
book-chapter, and so forth.
Each group object in the
group_bylist contains three properties:
Value: an integer; the number of entities in the group.
The "unknown" group is hidden by default. If you want to include this group in the response, add
:include_unknownafter the group-by parameter.
keyis the same as
key_display_name; both are the raw value of the
group_byparameter for this group.
meta.countis the total number of works (this will be all works if no filter is applied).
meta.groups_countis the count of groups (in the current page).
If there are no groups in the response,
Due to a technical limitation, we can only report the number of groups in the current page, and not the total number of groups.
The maximum number of groups returned is 200. If you want to get more than 200 groups, you can use cursor pagination. This works the same as it does when getting lists of entities, so head over to the section on paging through lists of results to learn how.
Due to technical constraints, when paging, results are sorted by key, rather than by count.