speedruncomorg / api

REST API Documentation for speedrun.com
350 stars 35 forks source link

Pagination is being gigacringe past 10000 elements #175

Closed CounterPillow closed 6 months ago

CounterPillow commented 6 months ago

Let's say I fetch offset 9800 in a Celeste category:

curl 'https://www.speedrun.com/api/v1/runs?category=7dgr144k&max=200&offset=9800'

This returns us, among other things:

    "pagination": {
        "offset": 9800,
        "max": 200,
        "size": 200,
        "links": [
            {
                "rel": "prev",
                "uri": "https://www.speedrun.com/api/v1/runs?category=7dgr144k&max=200&offset=9600"
            },
            {
                "rel": "next",
                "uri": "https://www.speedrun.com/api/v1/runs?category=7dgr144k&max=200&offset=10000"
            }
        ]
    }

Note the next uri. So let's try to fetch that next uri!

$ curl 'https://www.speedrun.com/api/v1/runs?category=7dgr144k&max=200&offset=10000'
{"status":400,"message":"Invalid pagination values.","links":[{"rel":"support","uri":"irc:\/\/speedrunslive.com#speedrun.com"},{"rel":"report-issues","uri":"https:\/\/github.com\/speedruncom\/api\/issues"}]}

Wow, thanks.

Is there some undocumented 10000 element limit for paginating? If so, why?

CounterPillow commented 6 months ago

Nvm, should've searched for "10000", this is a duplicate of #125