brapi_get_call: Internal Function for Core BrAPI GET Calls

View source: R/http.R

brapi_get_callR Documentation

Internal Function for Core BrAPI GET Calls

Description

Fetches data from an API endpoint, handles pagination by retrieving all pages, and consolidates the results into a single data frame.

Usage

brapi_get_call(call_url, nested = TRUE)

Arguments

call_url

Character string specifying the base URL of the API endpoint to request.

nested

Logical value indicating whether to flatten nested lists in the JSON responses. Defaults to TRUE.

Details

This function performs the following steps:

  1. Fetches the first page synchronously to determine the total number of pages.

  2. If multiple pages exist, it asynchronously fetches the remaining pages using get_async_pages().

  3. Consolidates the data from all pages into a single data frame.

  4. Updates global state variables with pagination information.

It relies on global variables from qbms_globals to manage state and configuration.

Value

A list containing the consolidated data and associated metadata from the API response.

Author(s)

Khaled Al-Shamaa, k.el-shamaa@cgiar.org


icarda-git/QBMS documentation built on Sept. 25, 2024, 10:45 p.m.