-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexplore.R
77 lines (47 loc) · 1.66 KB
/
explore.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
library(qualtRics)
help(package = "qualtRics")
id <- all_surveys()$id[4]
test <- fetch_survey(id)
# recode values
survey_questions(id)
extract_colmap(test)
md <- metadata(id)
q <- md$questions
names(q)
q$QID1
column_map(id)
fetch_description(id)
metadata(id)
survey_questions(id)
fetch_survey(id, add_column_map = T, add_var_labels = T) %>% View()
fetch_survey(id, label = F, convert = F) %>% View()
# mailing list
all_mailinglists()
fetch_mailinglist("ML_cROpOLdqoh22Tyu")
debugonce(fetch_mailinglist) # leverages list contacts api
?qualtRics::generate_url
?qualtRics:::qualtrics_api_request # httr request
# https://api.qualtrics.com/api-reference/YXBpOjYwOTE3-contacts
# create contact api -> post request
# update contact api -> in conjunction with generate_codes...
qualtRics::generate_url()
## How to add --data to the post request??
library(httr)
url <- "https://fra1.qualtrics.com/API/v3/mailinglists/ML_cROpOLdqoh22Tyu/contacts/"
url <- "http://httpbin.org/get"
r <- GET(url, add_headers(h))
r
headers(r)
content(r)
post_url <- "https://fra1.qualtrics.com/API/v3/mailinglists/ML_cROpOLdqoh22Tyu/contacts"
test <- "{}"
r <- POST(post_url, add_headers(h), body = body, encode = "json")
r
http_status(r)
post_url <- "https://ca1.qualtrics.com/API/v3/directories/directoryId/mailinglists/mailingListId/contacts"
headr <- add_headers("Content-Type" = "application/son", "X-API-TOKEN" = "")
b <- list(firstName = "string", lastName = "string", email = "string", phone = "string",
extRef = "string", embeddedData = list(property1 = "string", property2 = "string"),
language = "string", unsubscribed = TRUE)
r <- POST(post_url, headr, body = b)
r