| title | Reading data from APIs | ||||
|---|---|---|---|---|---|
| subtitle | |||||
| author | Jeffrey Leek | ||||
| job | Johns Hopkins Bloomberg School of Public Health | ||||
| logo | bloomberg_shield.png | ||||
| framework | io2012 | ||||
| highlighter | highlight.js | ||||
| hitheme | tomorrow | ||||
| url |
|
||||
| widgets |
|
||||
| mode | selfcontained |
https://dev.twitter.com/docs/api/1/get/blocks/blocking
[https://dev.twitter.com/apps](https://dev.twitter.com/appsmyapp <- oauth_app("twitter", key = "TYrWFPkFAkn4G5BbkWINYw"))
myapp = oauth_app("twitter",
key="yourConsumerKeyHere",secret="yourConsumerSecretHere")
sig = sign_oauth1.0(myapp,
token = "yourTokenHere",
token_secret = "yourTokenSecretHere")
homeTL = GET("https://api.twitter.com/1.1/statuses/home_timeline.json", sig)json1 = content(homeTL)
json2 = jsonlite::fromJSON(toJSON(json1))
json2[1,1:4] created_at id id_str
1 Mon Jan 13 05:18:04 +0000 2014 4.225984e+17 422598398940684288
text
1 Now that P. Norvig's regex golf IPython notebook hit Slashdot, let's see if our traffic spike tops the previous one: http://t.co/Vc6JhZXOo8
https://dev.twitter.com/docs/api/1.1/get/search/tweets
https://dev.twitter.com/docs/api/1.1/overview
- httr allows
GET,POST,PUT,DELETErequests if you are authorized - You can authenticate with a user name or a password
- Most modern APIs use something like oauth
- httr works well with Facebook, Google, Twitter, Githb, etc.





