Pagination
How pagination works on the Rated API.
Pagination operates in reverse chronological order, starting from the most recent complete day and working back to genesis.
In order for Rated to accurately calculate the data for a given day, it is essential that the "day" has passed in its entirety, allowing us to fetch all slots.
{
"page": {
"from": 798,
"to": 789,
"size": 10
},
"total": 798,
"data": [
...
],
"next": "https://api.rated.network/v0/eth/validators/1/effectiveness?from=788&size=10"
}
When you get data from the Rated API, you can choose a time frame by setting start and end days. Just use the
from
and to
query parameters. You can also pick how many items show up per page by using the
size
query parameter. The default is 10 items per page.So
from=700&size=10
will return data from day 700
until day 691
.Using
datetime
is also supported in from
and to
. Alternatively, one could query from=2022-12-01&size=10
to obtain data from 2022-12-01
. In this case the Rated API will convert the date to the
day
that was completed on the 2022-12-01
, essentially retrieving data for the period between 2022-11-30 12:00:23
and 2022-12-01 12:00:11
.When you get data from the Rated API, it might give you a link to more data if there's more than one page of results.
Just use the URL in
next
to continue fetching the rest of the data. When there's no more data left, the Rated API will stop giving you the link and show
next: null
. If you didn't set a end date with the to
query parameter, it will keep giving you data all the way back to the genesis.Last modified 1mo ago