To access data from your surways, you firstly need to store your login name (subdomain) and API Key. This can be done in two ways as described below.
Initially, this has been written by Scott Chamberlain, who wrote it in the NEWS file of his rnoaa
package. I have addapted the names of my functions accordingly.
PS: Don’t use my key, of course.
A new helper function
auth_name()/auth_api()
looks for one of two stored keys, as an environment variable under the nameWufoo_Name
/Wufoo_API
, or an option variable under the nameWufoo_Name
/Wufoo_API
.
Environment variables can be set during session like
Sys.setenv(VAR = "...")
, or stored long term in your.Renviron
file. Option variables can be set during session likeoptions(var = "...")
, or stored long term in your.Rprofile
file.
library(WufooR)
options(Wufoo_Name = "johnmalc", Wufoo_API = "F1QH-Q64B-BSBI-JASJ")
Print information about my name & api key.
auth_name(NULL)
## [1] "johnmalc"
auth_key(NULL)
## [1] "F1QH-Q64B-BSBI-JASJ"
Let’s print some information about the user.
t(user_info())
## 1
## User "johnmalc"
## Email "f789gh@yahoo.com"
## TimeZone "2.00"
## Company ""
## IsAccountOwner "1"
## CreateForms "1"
## CreateReports "1"
## CreateThemes "1"
## AdminAccess "0"
## Image "boy_1"
## ApiKey "F1QH-Q64B-BSBI-JASJ"
## LinkForms "https://johnmalc.wufoo.com/api/v3/forms.json"
## LinkReports "https://johnmalc.wufoo.com/api/v3/reports.json"
## Hash "n1asm5y21d1enjq"
## ImageUrlBig "https://wufoo.com/images/avatars/big/boy_1.png"
## ImageUrlSmall "https://wufoo.com/images/avatars/small/boy_1.png"
## HttpsEnabled "1"
And now about the forms you have access to.
t(form_info())
## 1
## Name "This form has some very nice name"
## Description "This is my form. Please fill it out. It's awesome!"
## RedirectMessage "Great! Thanks for filling out my form!"
## Url "this-form-has-some-very-nice-name"
## Email ""
## IsPublic "1"
## Language "english"
## StartDate "2000-01-01 12:00:00"
## EndDate "2030-01-01 12:00:00"
## EntryLimit "0"
## DateCreated "2015-07-04 02:07:34"
## DateUpdated "2015-07-04 05:28:43"
## Hash "z5kqx7h1gtvg4g"
## LinkFields "https://johnmalc.wufoo.com/api/v3/forms/z5kqx7h1gtvg4g/fields.json?includeTodayCount=false"
## LinkEntries "https://johnmalc.wufoo.com/api/v3/forms/z5kqx7h1gtvg4g/entries.json?includeTodayCount=false"
## LinkEntriesCount "https://johnmalc.wufoo.com/api/v3/forms/z5kqx7h1gtvg4g/entries/count.json?includeTodayCount=false"
## EntryCountToday "0"
# Show responses to the form
fe_1 <- form_entries(formIdentifier = "z5kqx7h1gtvg4g")
t(fe_1)
## 1
## Entry Id "1"
## First Name "JOhn"
## Last Name "Malc"
## Email "asdasfjf@asldjfsdjf.con"
## Untitled "Just testing 1"
## Address NA
## Address Line 2 NA
## City NA
## State / Province / Region NA
## Postal / Zip Code NA
## Country NA
## Amount NA
## Time NA
## Website NA
## Phone Number "6516566588"
## Date Created "2015-07-04 15:27:54"
## Created By "public"
## DateUpdated NA
## Updated By NA
## 2
## Entry Id "2"
## First Name "Zanic"
## Last Name "Mornarnd"
## Email "lsjdfnsdjfNkjn@kdfjnsdkfjn.com"
## Untitled "kdjsnfsdjfnsdjnvcjcnqoencqocn "
## Address "sjdfnsdjnf"
## Address Line 2 "skdjnojdvn"
## City "Prague"
## State / Province / Region "jfsndkjn"
## Postal / Zip Code "16565"
## Country "Australia"
## Amount "5616.22"
## Time "12:45:54"
## Website "http://www.jdslknsdj.com"
## Phone Number "5554486548"
## Date Created "2015-07-05 15:12:37"
## Created By "johnmalc"
## DateUpdated NA
## Updated By NA
sapply(fe_1, class)
## Entry Id First Name
## "character" "character"
## Last Name Email
## "character" "character"
## Untitled Address
## "character" "character"
## Address Line 2 City
## "character" "character"
## State / Province / Region Postal / Zip Code
## "character" "character"
## Country Amount
## "character" "character"
## Time Website
## "character" "character"
## Phone Number Date Created
## "character" "character"
## Created By DateUpdated
## "character" "character"
## Updated By
## "logical"
# How many responses did you get ?
form_entriesCount(formIdentifier = "z5kqx7h1gtvg4g")
## [1] "2"
Show its fields, with the requested URL (for debug purposes).
fields_info(formIdentifier = "z5kqx7h1gtvg4g", showRequestURL = TRUE)
## The requested URL has been this: https://johnmalc.wufoo.com/api/v3/forms/z5kqx7h1gtvg4g/fields.json
## Title Type ID Instructions IsRequired
## 11 Created By text CreatedBy <NA> <NA>
## 10 Date Created date DateCreated <NA> <NA>
## 1 Entry Id text EntryId <NA> <NA>
## 2 First Name shortname Field1 <NA> 0
## 6 Amount money Field10 <NA> 0
## 5 Address address Field11 <NA> 0
## 15 Address Line 2 <NA> Field12 <NA> <NA>
## 16 City <NA> Field13 <NA> <NA>
## 17 State / Province / Region <NA> Field14 <NA> <NA>
## 18 Postal / Zip Code <NA> Field15 <NA> <NA>
## 19 Country <NA> Field16 <NA> <NA>
## 14 Last Name <NA> Field2 <NA> <NA>
## 3 Email email Field3 <NA> 0
## 4 Untitled textarea Field5 <NA> 0
## 9 Phone Number phone Field6 <NA> 0
## 8 Website url Field8 <NA> 0
## 7 Time time Field9 <NA> 0
## 12 Last Updated date LastUpdated <NA> <NA>
## 13 Updated By text UpdatedBy <NA> <NA>
## ClassNames DefaultVal Page Label
## 11 <NA> <NA> <NA> <NA>
## 10 <NA> <NA> <NA> <NA>
## 1 <NA> <NA> <NA> <NA>
## 2 <NA> <NA> 1 First
## 6 <NA> <NA> 1 <NA>
## 5 <NA> <NA> 1 Street Address
## 15 <NA> <NA> <NA> Address Line 2
## 16 <NA> <NA> <NA> City
## 17 <NA> <NA> <NA> State / Province / Region
## 18 <NA> <NA> <NA> Postal / Zip Code
## 19 <NA> <NA> <NA> Country
## 14 <NA> <NA> <NA> Last
## 3 <NA> <NA> 1 <NA>
## 4 <NA> <NA> 1 <NA>
## 9 <NA> <NA> 1 <NA>
## 8 <NA> <NA> 1 <NA>
## 7 <NA> <NA> 1 <NA>
## 12 <NA> <NA> <NA> <NA>
## 13 <NA> <NA> <NA> <NA>
Do you have some reports ? If yes, then show me information about them.
t(reports_info())
## 1
## Name "Untitled Report"
## IsPublic "1"
## Url "untitled-report"
## Description "This is my report. View it in all its glory!"
## DateCreated "2015-07-04 03:31:55"
## DateUpdated "2015-07-10 02:39:43"
## Hash "z5kqx7h1gtvg4g"
## LinkFields "https://johnmalc.wufoo.com/api/v3/reports/z5kqx7h1gtvg4g/fields.json?="
## LinkEntries "https://johnmalc.wufoo.com/api/v3/reports/z5kqx7h1gtvg4g/entries.json?="
## LinkEntriesCount "https://johnmalc.wufoo.com/api/v3/reports/z5kqx7h1gtvg4g/entries/count.json?="
## LinkWidgets "https://johnmalc.wufoo.com/api/v3/reports/z5kqx7h1gtvg4g/widgets.json?="