MyNixOS website logo
Description

Access the 'Quickbase' JSON API.

Programmatically access the 'Quickbase' JSON API <https://developer.quickbase.com>. You supply parameters for an API call, 'qbr' delivers an http request to the API endpoint and returns its response. Outputs follow 'tidyverse' philosophy.

qbr

CRANstatus CRAN RStudio mirrordownloads

The goal of qbr is to make it easy to interact with Quickbase’s JSON API.

Installation

You can install the development version of qbr like so:

 library(devtools)
 install_github("BHII-KSC/qbr")

Functions

API pageFunctionDescription
Usersget_usersReturns a tibble with details of each user in an account
User tokenclone_tokenCopy a usertoken
User tokendeactivate_tokenDeactivate a usertoken
User tokendelete_tokenDelete a usertoken
Appsget_appGet metadata for an app
Appscopy_appCopy an app
Appsdelete_appDelete an app
Appsget_app_eventsReturns a tibble of triggerable events
Tablesget_tablesGet metadata for all tables in an app
Fieldsget_fieldsGet metadata for all fields in a table
Reportsget_reportReturns a named list of metadata for the specified report
Reportsget_reportsReturns a tibble of metadata for each report in a table
Reportsrun_reportReturns a tibble containing all data in the specified report
Recordsdelete_recordsDeletes records matching query conditions
N/Asummarize_appGet metadata for an app and its users, tables, and fields

Usage

It is often cumbersome to manually download data from Quickbase to work on it in R. run_report makes it easy to extract report data via the Quickbase JSON API:

library(qbr)

# Get data from a Quickbase report as a tibble
run_report(subdomain = "bhi",
       auth = keyring::key_get("qb_example"),
       table_id = "bn9d8iesz",
       report_id = "7")
#> # A tibble: 6 × 5
#>   `Record ID#` `Date assessed` `Respondent type` Intuitive            Accessible
#>          <int> <chr>           <chr>             <chr>                <chr>     
#> 1            2 2018-12-19      Data analyst      4 - Somewhat agree   4 - Somew…
#> 2            1 2018-12-19      Data analyst      5 - Strongly agree   4 - Somew…
#> 3            3 2018-12-19      Evaluator         1 - Strongly disagr… 2 - Somew…
#> 4            4 2018-12-19      Evaluator         3 - Neutral          4 - Somew…
#> 5           20 2019-12-04      Data analyst      2 - Somewhat disagr… 3 - Neutr…
#> 6            5 2019-11-27      Data analyst      2 - Somewhat disagr… 4 - Somew…

Notice that this function returns a tibble even though the payload from Quickbase is non-tabular JSON. This function extracts data from the Quickbase report (recursively if needed to handle the API’s auto-pagination) and then makes the data tidy using ‘tidyverse’ principles.

If you don’t know the report ID of the report you want to retrieve data from, you can use get_reports to retrieve metadata about all reports in a table:

library(qbr)

get_reports(subdomain = "bhi",
            auth = keyring::key_get("qb_example"),
            table_id = "bn9d8iesz")
#> # A tibble: 6 × 13
#>   description        id    name  type  usedCount usedLast properties.displayOn…¹
#>   <chr>              <chr> <chr> <chr>     <int> <chr>    <lgl>                 
#> 1 ""                 6     Aspi… table        32 2023-08… FALSE                 
#> 2 ""                 5     Find… table        61 2023-08… FALSE                 
#> 3 ""                 1     List… table       124 2023-08… FALSE                 
#> 4 "Sorted by Date M… 2     List… table         0 <NA>     TRUE                  
#> 5 ""                 7     qbr … table        58 2023-08… FALSE                 
#> 6 ""                 8     qbr … table         4 2023-08… FALSE                 
#> # ℹ abbreviated name: ¹​properties.displayOnlyNewOrChangedRecords
#> # ℹ 6 more variables: query.fields <list>, query.filter <chr>,
#> #   query.formulaFields <list>, query.groupBy <list>, query.sortBy <list>,
#> #   query.tableId <chr>

It’s sometimes helpful to manage user tokens programmatically:

library(qbr)

# Clone a user token. The 'clone_name' must be unique. 
token <- clone_token(subdomain = "bhi", 
                     auth = keyring::key_get("qb_example"),
                     clone_name = "My new token",
                     clone_desc = "A token cloned by an R script")

# The token passed to 'auth' is deleted. Token supplied must be active.
delete_token(subdomain = "bhi", auth = token)
#> Token deleted

You can manage apps using the app functions:

library(qbr)

# Copy an app and print the new app's ID
app <- copy_app(subdomain = "bhi",
                auth = keyring::key_get("qb_example"),
                app_id = "bn9d8f78g",
                app_name = "R Testing copy",
                app_desc = "Used to test copy_app() from qbr package",
                keep_data = TRUE)

print(app$id)
#> [1] "btiuqitut"

# Delete the newly created app
delete_app(subdomain = "bhi",
           auth = keyring::key_get("qb_example"),
           app_id = app$id,
           app_name = app$name)
#> $deletedAppId
#> [1] "btiuqitut"

# Get the triggerable events of an app
get_app_events(subdomain = "bhi",
               auth = keyring::key_get("qb_example"),
               app_id = "bn9d8f78g")
#> # A tibble: 2 × 8
#>   type    isActive tableId  name  owner.email owner.id owner.name owner.userName
#>   <chr>   <lgl>    <chr>    <chr> <chr>       <chr>    <chr>      <chr>         
#> 1 webhook TRUE     bp5gg5b… Push… john.erdma… 5962446… John Erdm… jerdmann      
#> 2 webhook TRUE     bp84kms… GET … john.erdma… 5962446… John Erdm… jerdmann

Complex data types

This packages returns some field types slightly differently to a Quickbase report:

Field typeReturned data type
Multi-select textSemicolon-separated text
UserUser’s email address
List-userSemicolon-separated email addresses

Limitations

Some extended ASCII characters (codes 128-255) cannot be properly parsed when converting from JSON at present, such as ’ (&#146). Reports containing text and rich-text fields are the most likely to suffer an error resulting from the use of these extended characters.

This package makes no attempt to convert data types. Number fields in Quickbase may well be interpreted in the resulting tibble as characters. The run_report function does provide a type_suffix argument to allow you to discern the intended datatype more easily.

Metadata

Version

1.2.3

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows