HPZone_request_paginated: Performs a HPZone request with the given parameters.

HPZone_request_paginatedR Documentation

Performs a HPZone request with the given parameters.

Description

Convenience wrapper around [HPZone_request_query()]. This function automatically pulls the available number of records, rather than only the first 500. Note that the current maximum for batching is 500 rows, so increasing n_max is not recommended. This function is mainly intended for use when the query builder in [HPZone_request()] is insufficient. Usage of [HPZone_request()] is considerably easier otherwise. An order clause is automatically added if not present to account for the lack of proper automatic sorting in the API.

Usage

HPZone_request_paginated(
  query,
  ...,
  n_max = 500,
  scope = API_env$scope_standard,
  verbose = FALSE
)

Arguments

query

A GraphQL query to send to the HPZone API. Note that keywords 'skip' and 'take' cannot be present in the query; this function will add them.

...

Parameters to be passed to sprintf(). If empty, the body is not passed through sprintf().

n_max

Maximum number of entries to request per call.

scope

The desired scope; either standard or extended.

verbose

Can be used to display information about the looping request.

Value

A data frame containing all the responses gathered from the API. Only the items will be returned.

See Also

[HPZone_request()], [HPZone_convert_dates()]

Examples

## Not run: 
# Note the single quotes to facilitate double quote encapsulation for arguments.
HPZone_request_paginated(
  paste0('cases(where: {',
      'Case_creation_date: { gte: "2025-01-01" }',
    '}) {',
      'items { Case_creation_date, Case_number }',
     '}'))
# Or equal, making use of the sprintf integration:
startdate = "2025-01-01"
fields = c("Case_creation_date", "Case_number")
HPZone_request_paginated(
  'cases(where: { Case_creation_date: { gte: "%s" } }) { items { %s } }',
   startdate, stringr::str_c(fields, collapse=", ")
)

## End(Not run)

HPZoneAPI documentation built on April 9, 2026, 5:09 p.m.