basketballapi.net

Documentation / Start here

Paging

Walking through long lists with page numbers or a cursor.

Lists come in pages

Endpoints that return a list answer 50 records at a time. Ask for up to 200 with per_page.

Two ways to move on

  • A cursor (fastest): send cursor with the next_cursor from the last answer, until it comes back as null. A cursor answer counts nothing, so it stays quick on big lists.
  • Page numbers: send page=2, page=3 and so on. The first answer says total and total_pages.
GET /v1/games?competition=cp_4f2k9qxa&per_page=200
GET /v1/games?competition=cp_4f2k9qxa&per_page=200&cursor=eyJvIjoyMDAsIm4iOjIwMH0

What meta carries

FieldMeaning
countRecords in this answer.
next_cursorSend it as cursor for the next records, or null at the end.
page, per_pageWhere you are.
total, total_pagesHow many there are (not sent on a cursor answer).
next_page, prev_pageThe neighbouring page numbers, or null.