Learn R Programming

HPZoneAPI (version 1.1.0)

HPZone_request_raw: Performs a HPZone request with the given parameters.

Description

Note that there are several helper functions that make the use of the API a lot simpler; specifically [HPZone_request()], [HPZone_request_paginated()]. This should only be used as a last resort; if manual GraphQL queries are required, [HPZone_request_query()] is highly advised instead.

Usage

HPZone_request_raw(body, scope = API_env$scope_standard)

Value

An object containing the requested data points. This can be in different forms, depending on the request.

Arguments

body

A GraphQL query to send to the HPZone API, including all necessary bracketing and JSON-elements.

scope

The desired scope; either standard or extended.

See Also

[HPZone_request()], [HPZone_request_paginated()], [HPZone_request_query()]

Examples

Run this code
# Note the difference between the raw and convenience functions.
# These lines are equal:
if (FALSE) {
HPZone_request("cases", c("Case_creation_date", "Case_number"),
               where=c("Case_creation_date", ">=", "2025-01-01"))
HPZone_request_query(paste0('cases(where: { ',
                      'Case_creation_date: { gte: "2025-01-01" }',
                      '})',
                      '{ items { Case_creation_date, Case_number } }')
                    )
HPZone_request_raw(paste0('{"query": "{ cases(where: {',
                            'Case_creation_date: { gte: \\"2025-01-01\\" }',
                          '})',
                          '{ items { Case_creation_date, Case_number } }',
                          '}"}'))
}

Run the code above in your browser using DataLab