If I retrieve a question like so:
http://api.stackoverflow.com/0.8/questions/1429951&sort=votes
I expect the answers to be sorted by votes, but they're not.
How can I do this?
If I retrieve a question like so:
http://api.stackoverflow.com/0.8/questions/1429951&sort=votes
I expect the answers to be sorted by votes, but they're not.
How can I do this?
I believe the sort=votes
parameter is for when you are retrieving multiple questions in one API call, such as with this URL - the questions in the response are ordered by vote.
http://api.stackoverflow.com/0.8/questions/1429951;2383701;619895?sort=votes&type=jsontext
In terms of how you could sort the responses - you do have the up + the down vote count from which you could sort on your application side, or you could make another request to the api with the extracted answer IDs and sort=votes
, which is really a waste of resources when you already have all the data.
questions/{id}/answers
route and specify sort
. sort
on /questions/{id}
applies to the question(s) returned. {id}
is vectorized in both cases (in all cases, infact).
Commented
May 30, 2010 at 5:23
body=false
set.
Commented
May 30, 2010 at 5:45
answer_count
) you should do the sort locally. Otherwise a second request is necessary anyway, might as well have the sorting done on our end.
Commented
May 30, 2010 at 6:24