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

It looks like that is specific to google apps only? I'm trying to connect

So, I was able to reach the API in curl using:

curl -X GET -k --header "x-apikey: accesskey=XXXXX; secretkey=XXXXX"

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='',
+ 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!

1 Like

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.