Skip to content

Instantly share code, notes, and snippets.

@PhillRob
Created December 27, 2016 02:07
Show Gist options
  • Save PhillRob/4b156fb5585e22e06cb42e95ee3481c4 to your computer and use it in GitHub Desktop.
Save PhillRob/4b156fb5585e22e06cb42e95ee3481c4 to your computer and use it in GitHub Desktop.
# API
## install packages
install.packages(c("httr", "jsonlite", "lubridate"))
library(httr)
library(jsonlite)
options(stringsAsFactors = FALSE)
## set variables to get all records per form id
baseurl <- "https://api.fulcrumapp.com"
path <- "/api/v2/"
form <- "records.json?form_id="
formid <- "yourformid"
XApiToken = "yourapitoken"
req <-
GET(
url = paste0(baseurl, path, form,formid),
add_headers(`X-ApiToken` = XApiToken),
accept_json()
)
stop_for_status(req)
head(req$content)
r.json<-fromJSON(content(req,type="text"),flatten = T,simplifyDataFrame = T)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment