iterate_over_pages: Get All the Elements When Iteration Over Pages May Be...

View source: R/get-data.R

iterate_over_pagesR Documentation

Get All the Elements When Iteration Over Pages May Be Necessary

Description

Get all elements corresponding to a given url, since the API allows at most 20 pages, page[number] parameter of the url, each of which can contain at most 250 elements, the page[size] parameter. If there are less than 250 elements, then no iteration is needed because all elements are on the first page. Otherwise, multiple API calls will be needed to obtain all the results.

Usage

iterate_over_pages(url, quiet = TRUE)

Arguments

url

a valid API url that includes the page[size] and page[number] parameters.

quiet

logical; FALSE if you want detailed information printed to the console, TRUE otherwise. FALSE is recommended for longer calls to monitor the progress.

Value

a nested list containing all elements corresponding to the given url. Functionality is not yet implemented for obtaining all elements when there are more than 5000 elements.

Examples

## Not run: 
iterate_over_pages("https://api.regulations.gov/v4/comments?filter
[commentOnId]=09000064816e1a41&page[size]=250&page[number]=1&
sort=lastModifiedDate,documentId&api_key=DEMO_KEY")

## End(Not run)

q-w-a/regulationsgov documentation built on May 3, 2022, 8:23 p.m.