Endpoints with pages
Maps also return a
cursor. See Create map.
Rules for all cursors
- Send the cursor back exactly as you got it. Batch and crawl cursors are numbers. File and monitor event cursors are strings.
0is a valid cursor. Do not stop the loop on it.- For batch items and crawl pages, stop when
cursoris absent ornull. For files and monitor events, stop whenhas_moreisfalse. If more results remain without a next cursor, report an error. - If a request fails, or a cursor repeats, stop the loop with an error. Do not skip to the next page.
- To get all the results of a batch or a crawl, wait until its
statusiscompleted. While the job is still running, a response can contain acursorfor results that are not ready yet.
python -m pip install requests. Set the OLOSTEP_API_KEY environment variable before you run the samples.
Each sample stops with an error after 1,000 pages without a last page. This is a limit in the sample, not in the API. For a very large list, increase max_pages in Python or maxPages in Node.js.
Batch items
The batch items endpoint returns the results initems. Set status to completed or failed to filter them. Without status, the endpoint does not filter by status. These samples select completed. On the first request, leave out cursor.
failed.
Crawl pages
The crawl pages endpoint returns the pages inpages. The first request sends cursor=0.
Files and monitor events
Files and monitor events usehas_more and next_cursor. Send next_cursor as the cursor of the next request. Set limit from 1 to 100. Without limit, GET /v1/files returns all completed files for your team.
This sample lists your team’s completed files, 100 at a time. For the events of a monitor, use GET /v1/monitors/{monitor_id}/events and read the events from data in the same way.
Endpoints without pages
GET /v1/schedules and GET /v1/monitors return the full list in one response.
Next steps
Batches
Scrape a list of URLs in one job.
Retrieve content
Get the content of a result with its
retrieve_id.