labrinth icon indicating copy to clipboard operation
labrinth copied to clipboard

Ordering of Versions in API results

Open hypherionmc opened this issue 3 years ago • 5 comments

Is your feature request related to a problem? Please describe. Current it appears as if the version id's returned by the API is in a random order instead of from Old-New or New-Old.

Describe the solution you'd like Maybe add a flag that can be used to sort the results or just order them by default

Describe alternatives you've considered Currently, the solution I have, which I do not use, is to just go over each version and sort them by dates, but, this causes load on the API and would probably hit rate limits at one point or another

hypherionmc avatar May 09 '21 20:05 hypherionmc

In which routes is the ordering random?

Geometrically avatar May 17 '21 05:05 Geometrically

/api/v1/mod/{id} I checked with multiple mods and the data returned is in random order. I saw a comment on your discord that the newest is always the first result, but that doesn't seem to be the case

hypherionmc avatar May 17 '21 06:05 hypherionmc

Another option would be instead of returning a string of versions, return "id" and "date_published" for each version, that way the information you seem to want will be in the actual data, and not depend on the order of the elements, since The JSON syntax does not define any specific meaning to the ordering of the values

calloatti avatar May 17 '21 11:05 calloatti

Another option would be instead of returning a string of versions, return "id" and "date_published" for each version, that way the information you seem to want will be in the actual data, and not depend on the order of the elements, since The JSON syntax does not define any specific meaning to the ordering of the values

Not a bad idea. And the ordering isn't done by the JSON, it should be done by code that retrieves the data from the database/data storage

hypherionmc avatar May 17 '21 12:05 hypherionmc

I checked quickly, and the results on /v1/mod/{id}/version look to be ordered new-old

hypherionmc avatar May 17 '21 13:05 hypherionmc

Appears to be sorted from old to new now on /v2/project/{id}.

triphora avatar Sep 05 '22 03:09 triphora