Learn R Programming

ustfd (version 0.4.4)

ustfd_simple: Retrieve Fiscal Data API in a single call

Description

ustfd_simple() aggregates the workflow for retrieving data from the API into a single call.

Usage

ustfd_simple(
  endpoint,
  filter = NULL,
  fields = NULL,
  sort = NULL,
  page_size = NULL,
  page_number = NULL,
  user_agent = "http://github.com/groditi/ustfd"
)

Value

a list containing the following items

  • meta - the metadata returned by the API

  • data - the payload returned by the API in table form. See ustfd_response_payload()

Arguments

endpoint

required string representing an API endpoint

filter

optional list used to subset the data. See filter-syntax for more information.

fields

optional character vector of the fields to be retrieved

sort

optional string or character vector. Ordering defaults to ascending, to specify descending order precede the field name with '-'

page_size

optional integer for pagination

page_number

optional integer for pagination

user_agent

optional string

See Also

Other ustfd_user: endpoint_exists(), ustfd_all_pages(), ustfd_datasets(), ustfd_query(), ustfd_table_columns(), ustfd_tables()

Examples

Run this code
if (FALSE) {
library(ustfd)

exchange_rates <- ustfd_simple(
  'v1/accounting/od/rates_of_exchange',
   fields = c(
    'country_currency_desc', 'exchange_rate','record_date','effective_date'
   ),
   filter = list(
     record_date = c('>=' = '2020-01-01'),
     country_currency_desc = list('in' = c('Canada-Dollar','Mexico-Peso'))
   )
)
}

Run the code above in your browser using DataLab