Handling aggregation & comparison operators

Imagine a site like StackOverflow, Questions & Answers have to many relationship.

If I want to get most discussed questions, I’d do fetch questions whose count(answers.*) > 10

Similarly if I want to get all unanswered questions, I’d do fetch questions whose count(answers.*) = 0

Following are my attempts

GET api/questions?filters[answers__count__gte]=10
GET api/questions?filters[answers__count]=0

OR

GET api/questions?filters[count(answers)]=0

Does these make sense? is there any standard way to do this?

Any of those would be ok, and they all make sense conceptually.

Unfortunately, there isn’t yet a standard way to do this, but we’d love to have one eventually.

@dgeb @tkellen @steveklabnik Would you be up for creating a separate repo under the json-api organization where community members who are interested in trying to standardize ?filter (which is a lot of work but seems like a worthwhile project), could discuss and try to put together draft proposals?

@mudassir0909 @ethanresnick can you share more information about selected solution? Maybe some article or examples for requests/respones ?
Thx in advance

similar subject here: http://discuss.jsonapi.org/t/share-propose-a-filtering-strategy/257

there is two proposal. my favorite is the one with /filter[fieldName][$operator]=value

but for the count I would hesitate between:

GET api/questions?filter[count(answers)][$gte]=10
or
GET api/questions?filter[answers][$count][$gte]=10

Just want to +1 this. I feel having proper filtering is crucial for data exploration and-- eventually-- aggregations seems pretty crucial rather than having to do them out of spec.

Does seem to be another +1 to GraphQL for data based API…

Why is that exactly? There are 2 different elaborated strategies to be acceptably used on a RESTful API, and you don’t need to give up statelessness, cacheability, separation of concerns, and coherent uniform interface among other useful benefits.