NOTES.md

Notes

To grab the form data, we don't want get_form, because it tries to parse the JSON into something "R"-ey. We want the raw JSON as a list, to make it easier to manipulate. We will probably need a function for this too, similar to get_form, but doesn't do the jsonlite::fromJSON thing. Could be get_form_raw or something

Create a function that strips all IDs from the form data

Change the way we pick a template

the body in post_response will be unboxed JSON see jsonlite::toJSON

original get_form

get_form
function(form_id) {
  api = get_api()
  url = glue("https://api.typeform.com/forms/{form_id}")
  content = get_response(api = api, url)
  content
}

original get_response

get_response
function (api, url) 
{
    authorization = get_authorization(api)
    ua = httr::user_agent("https://github.com/csgillespie/rtypeform")
    resp = httr::GET(url, authorization, ua)
    cont = httr::content(resp, "text", encoding = "UTF-8")
    # below this is what we don't want
    content = jsonlite::fromJSON(cont) # this is trying to turn a JSON response into an R object, 
    # here that is turning your fields into nested data.frames
    # will make it really annoying to sort out all the ids
    check_api_response(resp, content)
    content
}


jr-packages/jrTypeform documentation built on March 25, 2020, 9:55 p.m.