Make an authenticated API request to CSIAPPS
Usage
make_request(
endpoint,
method = "GET",
body = NULL,
query = list(),
headers = list(),
token = NULL,
timeout = 20L,
verbose = FALSE,
paginate = FALSE,
max_pages = 50,
sandbox = is_sandbox_mode()
)Arguments
- endpoint
API endpoint path.
- method
HTTP method. Defaults to "GET"
- body
Optional request body for POST/PUT/PATCH requests; should be an R object that can be serialized to JSON
- query
Optional list of query parameters to include in the request URL
- headers
Optional list of additional HTTP headers to include in the request
- token
Authentication token. When not provided, it is resolved for the current Shiny session (the token stored by
server_wrapper()), falling back to theCSIAPPS_ACCESS_TOKENenvironment variable outside a session. Inside a Shiny session a not-yet-available token does not error: the request is cancelled quietly withshiny::req(), and the calling reactive or observer re-runs automatically once login completes (seetoken_ready()). Outside Shiny a missing token raises an error.- timeout
Request timeout in seconds; defaults to 20
- verbose
If TRUE, prints request and response details to the console for debugging purposes
- paginate
If TRUE, will attempt to paginate through results using "next" links in the API response. Defaults to FALSE.
- max_pages
Maximum number of pages to fetch when paginate = TRUE; defaults to 50 to prevent infinite loops
- sandbox
If TRUE, the request is routed to the local sandbox instead of the real REST API: no network call is made and no authentication is required. Only the warehouse endpoints are emulated; registration and auth endpoints (e.g.
api/registration/...,api/csiauth/me/) are not, and raise a 501 in sandbox unlesssandbox = FALSE(for registration reads, usefetch_org_options()/fetch_profiles()instead). Defaults tois_sandbox_mode(), which is TRUE by default. Disable sandbox mode globally withoptions(csiapps.sandbox = FALSE)(orCSIAPPS_ENV=production) to route requests to the production warehouse. See csiapps-sandbox for supported endpoints and limitations. In sandbox mode the HTTP-only arguments (headers,token,timeout,max_pages) are ignored, since no network request is made.
