I've been playing around with this API and cannot get the $order parameter to work when paired with DESC:
https://data.cityofnewyork.us/resource/9w7m-hzhe.json?$limit=100&$order=score%20DESC
Not only is the data not being sorted accordingly, but the column name/json key (score) I'm attempting to sort against is being omitted from the query results!
According to Socrata docs, you can set to ascending order by replacing the 'DESC' with 'ASC'. The same can be accomplished by not specifying it at all - it will default to ASC. And both of these work fine when I test.
But I can't get DESC to work at all. Thanks.
For some entries, the score
column contains nulls, which are sorted first because SQL is weird.
Try adding a filter for $where=score IS NOT NULL
:
GET https://data.cityofnewyork.us/resource/9w7m-hzhe.json?$limit=100&$order=score%20DESC&$where=score%20IS%20NOT%20NULL