ropensci-archive/rcoreoa

Adding api key

aarontaycheehsien opened this issue · 4 comments

Sorry for the basic question. How do I add my CORE API key ?

I tried adding to my .rprofile

options(rcoreoaApiKey= "xxxxxxxxxxxx") # rcoreoa

But when I run a simple command I get Error: you need an API key for Core

  1. I've checked the API key works in swagger
  2. I've checked the .rprofile key is read correctly and I've checked it works for PLOS API.

Any clues?

thanks for the question @aarontaycheehsien

You can find information in the vignette https://cran.rstudio.com/web/packages/rcoreoa/vignettes/cored_vignette.html -

I've also just added information to each man file in the packge, and to the readme, and the package level man file ?rcoreoa. reinstall to get the changes.

Thanks @sckott for taking the time to help a beginner in R. Think I got it.

BTW I think there's a portion there is a bit confusing.

In your example, you wrote

Within the .Renviron file you will add:
CORE_API=thisISyourAPIkeyITlooksLIKEaLONGstringOFletters

But then

Once you’ve added the API key, restart your R session and test to make sure the key has been added using the command:
Sys.getenv("CORE_KEY")

Shouldn't it read

Sys.getenv("CORE_API")

But of course you do go on to mention to check the variable name which helped.

Thanks again.

thanks @aarontaycheehsien I'm pretty sure the docs all read CORE_KEY now, let me know if you find that's not the case in the newest version here on github

Thanks again!