Parser example: paginated JSON API
A complete parser for a paginated JSON API that fetches one page of products per call.
A complete product sync parser for a paginated JSON API. Each fetch_next_chunk call requests one page of products and keeps the page number in state["parser"]["page"] for the next call. This is the natural shape for any REST source where one HTTP call returns one chunk. Copy the parser and adapt the request parameters and field mapping to your API.
For static feed files instead of an API, see Parser example: static XML feed and Parser example: multiple XML feeds.
Source shape: paginated-json-api
Fetching through the proxy. The _fetch_page helper tries a direct request first and falls back to fetch_via_proxy(), a built-in function that sends the request through Octocom's HTTP proxy from a stable, dedicated IP address. The fallback matters when the origin blocks direct requests. Typical symptoms are HTTPError 403, HTTPError 429 or unexplained urlopen timeouts. Signature:
fetch_via_proxy(url, *, headers=None, timeout=60, method='GET', data=None) -> bytes