Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 102769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T01:01:04+00:00 2026-05-11T01:01:04+00:00

consider the following http request: GET /defects?group-by=priority I would like the returned collection(feed) of

  • 0

consider the following http request:

GET /defects?group-by=priority 

I would like the returned collection(feed) of defects to be grouped by their priority. i.e. the returned feed consists of defects(resources) and group infromation.

I thought about something that will return the groups’ titles and count before returning the collection, for example:

<content> <Group val='High' count='567'/> <Group val='Medium' count='437'/>  <Group val='Low' count='19'/>  <Defect ,,,,> <Defect ,,,,> <Defect ,,,,> </content> 

The problem with such representation is that the queried resource (URL) is defect so the client expects collection of Defects and not the Group element.

I guess one option for solving this problem would be to define a separate groups resource for defects i.e.:

 defects/groups?group1=priority 

that will return collection of groups and their count, and then the client can query the defects resource for the data itself. But this design is cumbersome and requires extra round trips, not to mention possible consistency problems when defects was added\removed between the call to the group resource and the defects resource.

Bottom line, what is the restful way to return a collection of elements grouped by an attribute?

EDIT I first thought of that this problem should be addressed by the ATOM publishing standard. But even if ATOM had addressed it, I still need to support other representations (XML, JSON) so I am looking for a pattern more inherent in the RESTful approach.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T01:01:05+00:00Added an answer on May 11, 2026 at 1:01 am

    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.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 162k
  • Answers 162k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As far as I can tell, it looks like you're… May 12, 2026 at 12:02 pm
  • Editorial Team
    Editorial Team added an answer Use reflector (it's free!) to get in-depth information about classes… May 12, 2026 at 12:02 pm
  • Editorial Team
    Editorial Team added an answer I think MSDN misstated the matter slightly. When you call… May 12, 2026 at 12:02 pm

Related Questions

I have a C# WCF REST Service which allows the addition of a bookmark,
Consider the following Python code: 30 url = http://www.google.com/search?hl=en&safe=off&q=Monkey 31 url_object = urllib.request.urlopen(url); 32
Installed Mono 2.4 on Ubuntu using the instructions here: http://www.nabble.com/forum/PrintPost.jtp?post=22841086 When I run xsp
Consider following example : public class SomeBusinessLayerService : DataService<MyEntityContainer> { [WebInvoke] void DoSomething(string someParam)

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.