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

How to use API in R (without using packages such as qualtRics)

  • June 3, 2019
  • 1 reply
  • 40 views

Forum|alt.badge.img+6
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

Best answer by 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))

1 reply

Forum|alt.badge.img+6
  • Author
  • Level 1 ●
  • Answer
  • June 7, 2019
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))