What is the restful approach to compose a group by query
I don't think what you are asking for is possible.
If the client is expecting a collection of defects, then you can order by priority, but
a group of defects != a defect
So you can't return a collection of groups.
You could add a nasty hack to add attributes to the defect resource for priority and priority-group-size, but that seems bad to me.
I think the correct Restful ways to do it are:
- Design the service to return groups of defects
or
- Return defects ordered by priority, and let the client do the grouping and counting of the resources in each group.