Please go through this link and see if it answers your query.
Also, for group-based filter please try below and refer to link for extra help.
groups?$filter=NOT groupTypes/any(c:c eq 'Unified')&$count=true
Please let me know if there is some specific group type you are looking.
Thanks