Learn R Programming

request (version 0.1.0)

request-package: Easy http

Description

Easy http

Arguments

Examples

Run this code
## Not run: 
# ## Build API routes
# ### 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')
# 
# ## The above are not passed through a pipe, so simply define a URL, but don't
# ## do a request. To make an http request, you can either pipe a url or
# ## partial url to e.g., \code{\link{api}}, or call \code{\link{http}}
# 'https://api.github.com/' %>% api()
# ### Or
# api('https://api.github.com/') %>% http()
# 
# # Non-standard evaluation (NSE)
# api('https://api.github.com/') %>%
#   api_path(repos, ropensci, rgbif, issues) %>%
#   peep
# 
# # Standard evaluation (SE)
# api('https://api.github.com/') %>%
#   api_path_('repos', 'ropensci', 'rgbif', 'issues') %>%
#   peep
# 
# ## Templating
# repo_info <- list(username = 'craigcitro', repo = 'r-travis')
# api('https://api.github.com/') %>%
#   api_template(template = 'repos/{{username}}/{{repo}}/issues', data = repo_info) %>%
#   peep
# ## End(Not run)

Run the code above in your browser using DataLab