Skip to content

Instantly share code, notes, and snippets.

@jennybc
Last active September 5, 2017 10:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jennybc/78076eeaf09974435841a0eac40ccbb1 to your computer and use it in GitHub Desktop.
Save jennybc/78076eeaf09974435841a0eac40ccbb1 to your computer and use it in GitHub Desktop.
Goofing around with the catfacts API
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"
httr::GET("http://catfacts-api.appspot.com/api/facts",
query = list(number = 5)) %>%
httr::content(as = "text", encoding = "UTF-8") %>%
jsonlite::fromJSON()
@jennybc
Copy link
Author

jennybc commented Sep 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment