Catalog108 / challenges / api/rest/paginated-page

Paginated REST API (page-based)

beginner Matching curriculum →

What this challenge teaches

Teaches: ?page=N pagination on a JSON endpoint. Detect end via has_next.

Expected output: All products by walking ?page=1..N until has_next=false.

Submit your scraper's JSON output to /challenges/api/rest/paginated-page/grade (grader endpoint is part of a later phase; URL is reserved now).

# Walk all pages
import requests
page = 1
while True:
    r = requests.get(f"https://practice.scrapingcentral.com/challenges/api/rest/paginated-page?json=1&page={page}").json()
    for item in r["items"]:
        print(item["sku"], item["name"])
    if not r["has_next"]: break
    page += 1