paginate: Get responses from Canvas API pages

View source: R/process_response.R

paginateR Documentation

Get responses from Canvas API pages

Description

The Canvas headers include a link object (usually), in form: Link: <https://canvas.url/api/v1/[...]?page=1&per_page=10>; rel="current", <https://canvas.url/api/v1/[...]?page=2&per_page=10>; rel="next", <https://canvas.url/api/v1/[...]?page=1&per_page=10>; rel="first", <https://canvas.url/api/v1/[...]?page=15&per_page=10>; rel="last"

In this case, we need to download every page from 1 to 15 to capture all data. This function parses the response object intelligently, using only HEAD requests, to figure out these page requirements.

Usage

paginate(x, showProgress = T)

Arguments

x

a httr response object

showProgress

if TRUE (default), show a textual progress bar

Value

unparsed responses

Examples

## Not run: resp <- canvas_query(url, args, "HEAD")
get_pages(resp)
## End(Not run)

daranzolin/rcanvas documentation built on May 18, 2024, 2:33 p.m.