Page MenuHomeSoftware Heritage

Web API: make next link contain full URLs
Closed, MigratedEdits Locked

Description

For pagination purposes, the next links or our Web API look like this:

Link: </api/1/origin/1/visits/?last_visit=2&per_page=2>; rel="next",

while standard conformant, that is different from what GitHub/GitLab do, which have complete URLs starting with the scheme:

Link: <https://api.github.com/search/code?q=addClass+user%3Amozilla&page=2>; rel="next",
Link: <https://gitlab.example.com/api/v4/projects/8/issues/8/notes?page=3&per_page=3>; rel="next",

Also, our way is more annoying for clients to exploit, as it requires some URL gymnastic.

We should change our next links to contain full URLs too.

Event Timeline

zack triaged this task as Low priority.Dec 13 2019, 11:19 AM
zack created this task.

@zack, this is now deployed to production.

16:03 $ curl -i https://archive.softwareheritage.org/api/1/origin/search/python/
HTTP/1.1 200 OK
Date: Fri, 13 Dec 2019 15:04:54 GMT
Server: gunicorn/19.9.0
Content-Type: application/json
Link: <https://archive.softwareheritage.org/api/1/origin/search/python/?limit=70&offset=70&regexp=false>; rel="next"

@zack, this is now deployed to production.

awesome, thanks !