httr::GET("http://catfacts-api.appspot.com/api/facts",
query = list(number = 5)) %>%
httr::content(as = "text", encoding = "UTF-8") %>%
jsonlite::fromJSON()
#> $facts
#> [1] "The catnip plant contains an oil called hepetalactone which does for cats what marijuana does to some people. Not all cats react to it those that do appear to enter a trancelike state. A positive reaction takes the form of the cat sniffing the catnip, then licking, biting, chewing it, rub & rolling on it repeatedly, purring, meowing & even leaping in the air."
#> [2] "A cat's appetite is the barometer of its health. Any cat that does not eat or drink for more than two days should be taken to a vet."
#> [3] "Almost 10% of a cat's bones are in its tail, and the tail is used to maintain balance."
#> [4] "Tigers have been hunted for their skin, bones, and other body parts, used in traditional Chinese medicine."
#> [5] "Cat families usually play best in even numbers. Cats and kittens should be aquired in pairs whenever possible."
#>
#> $success
#> [1] "true"
Last active
September 5, 2017 10:41
-
-
Save jennybc/78076eeaf09974435841a0eac40ccbb1 to your computer and use it in GitHub Desktop.
Goofing around with the catfacts API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
httr::GET("http://catfacts-api.appspot.com/api/facts", | |
query = list(number = 5)) %>% | |
httr::content(as = "text", encoding = "UTF-8") %>% | |
jsonlite::fromJSON() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://catfacts-api.appspot.com/doc.html