apiPKG/README.md

apiPKG

A demo API package created by apitools

Document package

devtools::document()

Call various APIs

library(apiPKG)
api_call("somethingcool")
## [1] "https://api.PKG.com/v1.0/somethingcool"
api_call("articles/headlines")
## [1] "https://api.PKG.com/v1.0/articles/headlines"

Along with any number of parameters

api_call("articles/headlines", n = 500, filter = "en")
## [1] "https://api.PKG.com/v1.0/articles/headlines?n=500&filter=en"

Integrate API keys/tokens

api_call(
  "articles/headlines", 
  n = 500, 
  filter = "en", 
  token = apiPKG_token()
)
## [1] "https://api.PKG.com/v1.0/articles/headlines?n=500&filter=en&token=thisistheapikeyiwasprovided"

Send the actual request

rurl <- api_call(
  "articles/headlines", 
  n = 500, 
  filter = "en", 
  token = apiPKG_token()
)
r <- httr::GET(rurl)


mkearney/apitools documentation built on May 27, 2019, 7:45 a.m.