v0

How pagination works on the Rated API v0.

Ethereum Pagination

On Ethereum, Pagination operates in reverse chronological order, starting from the most recent 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.

Example of a paginated response

{
  "page": {
    "from": 798,
    "to": 789,
    "size": 10
  },
  "total": 798,
  "data": [
    ...
  ],
  "next": "https://api.rated.network/v0/eth/validators/1/effectiveness?from=788&size=10"
}

Pagination limits and page size

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.

Following next pages

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.

Polygon Pagination

Polygon pagination is based on either a checkpoint or date. Similar to Ethereum, when you get data from the Rated API, you can choose a time frame by using from query parameters. from can either take a completed Checkpoint or a date. 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=2023-01-01&size=10 will return data from date 2023-01-01 until date 2023-01-10.

Example of a paginated response

{
  "page": {
    "from": 798,
    "to": 789,
    "size": 10
  },
  "total": 798,
  "data": [
    ...
  ],
  "next": "https://api.rated.network/v0/eth/validators/1/effectiveness?from=788&size=10"
}

Following next pages

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.

Last updated

#141: v1 context added (pagination and api reference)

Change request updated