I am very new to RStudio and was wondering how someone would connect to a REST API that needs "x-apikey: accesskey=1234;secretkey=1234"? I have found other documentation but nothing has seemed to worked. Any guidance would be greatly appreciately.
you need to use Oauth and use the httr package.
This guide might help https://googledrive.tidyverse.org/articles/articles/bring-your-own-app.html#get-an-oauth-app-and-tell-googledrive-about-it
It looks like that is specific to google apps only? I'm trying to connect Tenable.sc
So, I was able to reach the API in curl using:
curl -X GET -k --header "x-apikey: accesskey=XXXXX; secretkey=XXXXX" https://scnessus.redacted.org/rest/currentUser
But the translation to R just gives me a "Resource is not supported." error message. I don't understand why it would work through command line but not through RStudio?
> require(httr) > headers = c('x-apikey' = 'accesskey=XXXXXXX; secretkey=XXXXXX') > tenable <- httr::POST(url='https://scnessus.redacted.org/rest/currentUser', + httr::add_headers(.headers=headers), config = httr::config(ssl_verifypeer = FALSE))
Maybe with curl you are GETting but with httr you are POSTing?
Haha, newbie mistake. Glad it was easy and right in front of my face. Appreciate the help!
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.
If you have a query related to it or one of the replies, start a new topic and refer back with a link.