How to use API in R (without using packages such as qualtRics) | XM Community
Skip to main content
Hi

I used to use API v2 for some tasks with our contacts. Now I'm not sure how I should construct my calls in R after they upgraded to v3, the 'Try' button on their API page isn't even working.

Any help would be greatly appreciated.

-Helgi
I found the answer. If anyone is also in trouble, here is the answer:

https://cran.r-project.org/web/packages/curl/vignettes/intro.html#customizing_requests



library(curl)

library(jsonlite)

h <- new_handle()

handle_setheaders(h,

"X-API-TOKEN" = "my_token"

)

req <- curl_fetch_memory("https://yourdatacenterid.qualtrics.com/API/v3/users", handle = h)

jsonlite::prettify(rawToChar(req$content))

Leave a Reply