Topic: [Feature] API: Allow sorting by id for /tag/index or make presence of after_id parameter force sorting by ID

Posted under Site Bug Reports & Feature Requests

Requested feature overview description.
Results returned by the API endpoint /tag/index are always either sorted by date, count or name (as specified in the API help page ). They are never sorted by ID, even when the after_id parameter is used (which could even be considered a bug). Using order=id returns the same order as order=count or no order parameter at all.
Here is an example of where this is a problem:
First batch (returns IDs 12054, 7115, 26 and 78): https://e621.net/tag/index.xml?limit=4&after_id=0
Second batch (returns IDs 13731, 168227, 22464 and 18933): https://e621.net/tag/index.xml?limit=4&after_id=12054
If everything was working correctly there should be no tags with IDs between ID 12054 (highest in first batch) and ID 13731 (lowest in second batch), yet there are:
https://e621.net/tag/show.xml?id=12056

This means the only way to go through all tags is to use the pagination which (just like with posts as explained by the API help page ) has the problem that tags can shift from one page to another between requests. So tags can be returned multiple times (not a problem) or not at all (a big problem).

In this feature request I would like to requests adding an option to sort tags by id.
Alternatively, requests containing an after_id parameter could ignore the order parameter and be forced to be sorted by id, just like /post/index.xml does.

Why would it be useful?
It enables the only way of reliably querying lists of tags.

What part(s) of the site page(s) are affected?
The API endpoints /tag/index.xml and its JSON and HTML counterparts.

  • 1