api {request} | R Documentation |
API base url and endpoint setup
api(x) api_path(.data, ..., .dots) api_path_(.data, ..., .dots) api_template(.data, template, data)
x |
A URL |
.data |
Result of a call to |
... |
Comma separated list of unquoted variable names |
.dots |
Used to work around non-standard evaluation |
template |
Template to contstruct API route |
data |
Data to pass to the template parameter |
Other dsl: api_body
,
api_config
,
api_error_handler
, api_query
,
auth
## Not run: # Set base url ## works with full or partial URLs api('https://api.github.com/') api('http://api.gbif.org/v1') api('api.gbif.org/v1') ## works with ports, full or partial api('http://localhost:9200') api('localhost:9200') api(':9200') api('9200') api('9200/stuff') # set paths ## NSE api('https://api.github.com/') %>% api_path(repos, ropensci, rgbif, issues) ## SE api('https://api.github.com/') %>% api_path_('repos', 'ropensci', 'rgbif', 'issues') # template repo_info <- list(username = 'craigcitro', repo = 'r-travis') api('https://api.github.com/') %>% api_template(template = 'repos/{{username}}/{{repo}}/issues', data = repo_info) ## End(Not run)