Skip to contents

Low-level function to execute a query built with compose_data_query(). Handles rate limiting, retries, and error handling.

Usage

execute_query(api, url, body = NULL, verbose = FALSE)

Arguments

api

A <px_api> object.

url

API endpoint URL.

body

JSON body as a list, or NULL for GET requests.

verbose

Print request details.

Value

Parsed JSON as a list, or NULL on failure.

Examples

# \donttest{
scb <- px_api("scb", lang = "en")
if (px_available(scb)) {
  q <- compose_data_query(scb, "TAB638", Region = "0180", Tid = px_top(3))
  raw <- execute_query(scb, q$url, q$body)
}# }
#> Warning: PX-Web API returned HTTP 400: {"type":"Parameter error","title":"Missing selection for mandantory variable","status":400}