Page MenuHomeSoftware Heritage

Web API: return visits most-recent-first and document the order
Closed, MigratedEdits Locked

Description

The list of visits (see example) is returned oldest-visit-first and that's generally not what a user would want, especially given that one needs to go through the entire pagination to get the most recent one.
The API should return visits in most-recent-first order instead.

Also, we should document what the order is in the documentation (which is currently silent about the sort criteria).

Event Timeline

zack triaged this task as Low priority.May 4 2018, 9:39 PM
zack created this task.

@anlambert Doesn't this still need a fix in swh-storage? ISTR there are some inconsistencies as to which order the visits are returned there, and doing a full iteration won't work in all cases (e.g. when several visits end up on the same date).

For the moment, I prefer to simply sort the visits returned by the api endpoint directly in swh-web in order to return them in most-recent-first order as requested.
Pagination is based on the visits id so all visits are correctly returned by the api, even those ending up on the same date (for instance https://archive.softwareheritage.org/api/1/origin/65623577/visits/?last_visit=57).

I had a look at the code in swh-storage and indeed the pagination code for listing the origin visits there is wrong.

I'll look into fixing it