Skip to content

Instantly share code, notes, and snippets.

@benneely
Created July 2, 2015 19:35
Show Gist options
  • Save benneely/b810df79b17d446fb3d0 to your computer and use it in GitHub Desktop.
Save benneely/b810df79b17d446fb3d0 to your computer and use it in GitHub Desktop.
translate cURL to httr (R package) syntax
library(httr)
#Usual cURL GET call
# curl https://api.github.com/users/defunkt
GET('https://api.github.com/users/defunkt')
#Pass custom header
# curl -i -H 'Authorization: token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' https://api.github.com/repos/benneely/trailR/issues?state=all
GET('https://api.github.com/repos/benneely/trailR/issues?state=all', add_headers('Authorization' = 'token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment