Assignment - Web APIs
The New York Times web site provides a rich set of APIs, as described here: http://developer.nytimes.com/docs You’ll need to start by signing up for an API key. Your task is to choose one of the New York Times APIs, construct an interface in R to read in the JSON data, and transform it to an R dataframe.
## Loading required package: bitops
Key = "&api-key=3ac6f7195a6f43358b12f1993627b5a2"
url = "http://api.nytimes.com/svc/books/v3/reviews.json?"
author='author=Haruki%20Murakami'
bookInfo <-getURL(paste0(url,author,Key))
book.jason<-fromJSON(bookInfo)
book.df<- data.frame(book.jason)
book.df
## status
## 1 OK
## 2 OK
## 3 OK
## 4 OK
## 5 OK
## 6 OK
## 7 OK
## 8 OK
## 9 OK
## 10 OK
## 11 OK
## 12 OK
## 13 OK
## 14 OK
## 15 OK
## 16 OK
## 17 OK
## 18 OK
## 19 OK
## copyright
## 1 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 2 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 3 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 4 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 5 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 6 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 7 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 8 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 9 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 10 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 11 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 12 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 13 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 14 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 15 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 16 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 17 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 18 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## 19 Copyright (c) 2017 The New York Times Company. All Rights Reserved.
## num_results
## 1 19
## 2 19
## 3 19
## 4 19
## 5 19
## 6 19
## 7 19
## 8 19
## 9 19
## 10 19
## 11 19
## 12 19
## 13 19
## 14 19
## 15 19
## 16 19
## 17 19
## 18 19
## 19 19
## results.url
## 1 http://www.nytimes.com/2011/11/10/books/1q84-by-haruki-murakami-review.html
## 2 http://www.nytimes.com/1999/02/17/books/books-of-the-times-an-obsessive-attraction-that-cripples-two-lives.html
## 3 http://www.nytimes.com/1997/11/02/books/east-meets-west.html
## 4 http://www.nytimes.com/1993/03/28/books/as-japanese-as-burt-bacharach.html
## 5 http://www.nytimes.com/2011/11/06/books/review/1q84-by-haruki-murakami-translated-by-jay-rubin-and-philip-gabriel-book-review.html
## 6 http://www.nytimes.com/2014/08/10/books/review/haruki-murakamis-colorless-tsukuru-tazaki-and-his-years-of-pilgrimage.html
## 7 http://www.nytimes.com/2006/09/17/books/review/Rafferty2.t.html
## 8 http://www.nytimes.com/1993/05/12/books/books-of-the-times-from-japan-big-macs-and-marlboros-in-stories.html
## 9 http://www.nytimes.com/1994/01/03/books/books-of-the-times-looking-for-america-or-is-it-japan.html
## 10 http://www.nytimes.com/1997/10/31/books/books-of-the-times-on-a-nightmarish-trek-through-history-s-web.html
## 11 http://www.nytimes.com/2000/09/24/books/rubber-souls.html
## 12 http://www.nytimes.com/2001/06/10/books/lost-in-orbit.html
## 13 http://www.nytimes.com/2002/08/18/books/a-shock-to-the-system.html
## 14 http://www.nytimes.com/2002/08/20/books/books-of-the-times-worlds-where-anything-normal-would-seem-bizarre.html
## 15 http://www.nytimes.com/2002/08/25/books/and-bear-in-mind.html
## 16 http://www.nytimes.com/2007/06/03/books/review/Kirn-t.html
## 17 http://www.nytimes.com/2008/08/10/books/review/Dyer-t.html
## 18 http://www.nytimes.com/2005/02/06/books/review/kafka-on-the-shore-realitys-culdesacs.html
## 19 https://www.nytimes.com/2017/05/09/books/review/men-without-women-haruki-murakami.html
## results.publication_dt results.byline
## 1 2011-11-10 JANET MASLIN
## 2 1999-02-17 RICHARD BERNSTEIN
## 3 1997-11-02 JAMIE JAMES
## 4 1993-03-28 DAVID LEAVITT
## 5 2011-11-06 KATHRYN SCHULZ
## 6 2014-08-10 PATTI SMITH
## 7 2006-09-17 TERRENCE RAFFERTY
## 8 1993-05-12 HERBERT MITGANG
## 9 1994-01-03 HERBERT MITGANG
## 10 1997-10-31 MICHIKO KAKUTANI
## 11 2000-09-24 JANICE P. NIMURA
## 12 2001-06-10 DANIEL ZALEWSKI
## 13 2002-08-18 JEFF GILES
## 14 2002-08-20 MICHIKO KAKUTANI
## 15 2002-08-25
## 16 2007-06-03 WALTER KIRN
## 17 2008-08-10 GEOFF DYER
## 18 2005-02-06 LAURA MILLER
## 19 2017-05-09 JAY FIELDEN
## results.book_title
## 1 1Q84
## 2 South of the Border, West of the Sun
## 3 Wind-Up Bird Chronicle
## 4 Elephant Vanishes : Stories
## 5 1Q84
## 6 Colorless Tsukuru Tazaki and His Years of Pilgrimage
## 7 Blind Willow, Sleeping Woman: Twenty-Four Stories
## 8 The Elephant Vanishes: Stories
## 9 Dance Dance Dance: A Novel
## 10 The Wind-Up Bird Chronicle
## 11 Norwegian Wood
## 12 Sputnik Sweetheart
## 13 After the Quake
## 14 After the Quake
## 15 After the Quake
## 16 After Dark
## 17 What I Talk About When I Talk About Running
## 18 Kafka on the Shore
## 19 Men Without Women: Stories
## results.book_author
## 1 Haruki Murakami
## 2 Haruki Murakami
## 3 Haruki Murakami
## 4 Haruki Murakami
## 5 Haruki Murakami
## 6 Haruki Murakami
## 7 Haruki Murakami
## 8 Haruki Murakami
## 9 Haruki Murakami
## 10 Haruki Murakami
## 11 Haruki Murakami
## 12 Haruki Murakami
## 13 Haruki Murakami
## 14 Haruki Murakami
## 15 Haruki Murakami
## 16 Haruki Murakami
## 17 Haruki Murakami
## 18 Haruki Murakami
## 19 Haruki Murakami
## results.summary
## 1 In <U+0093>1Q84,<U+0094> the Japanese novelist Haruki Murakami writes about characters in a Tokyo with two moons.
## 2
## 3
## 4
## 5 Haruki Murakami has translated Raymond Chandler into Japanese, and there<U+0092>s a lot of Marlowe to his madness.
## 6 Patti Smith reviews Haruki Murakami<U+0092>s dreamlike new novel, in which a man seeks out old friends to understand why he was banished from their circle.
## 7 A career-spanning grab bag of short stories from Haruki Murakami.
## 8
## 9
## 10
## 11
## 12
## 13
## 14
## 15
## 16 Haruki Murakami<U+0092>s novel features two sisters, one in an enchanted sleep, the other up all night.
## 17 In his latest book -- part training guide, part memoir -- Haruki Murakami connects the disciplines of running and writing.
## 18 <p> KAFKA ON THE SHORE By Haruki Murakami. Translated by Philip Gabriel. 436 pp. Alfred A. Knopf. $25.95.</p>.
## 19 In the seven stories that make up <U+0093>Men Without Women,<U+0094> Haruki Murakami strikes a blue note: a rainy Tokyo full of unfaithful women.
## results.uuid
## 1 00000000-0000-0000-0000-000000000000
## 2 00000000-0000-0000-0000-000000000000
## 3 00000000-0000-0000-0000-000000000000
## 4 00000000-0000-0000-0000-000000000000
## 5 00000000-0000-0000-0000-000000000000
## 6 00000000-0000-0000-0000-000000000000
## 7 00000000-0000-0000-0000-000000000000
## 8 00000000-0000-0000-0000-000000000000
## 9 00000000-0000-0000-0000-000000000000
## 10 00000000-0000-0000-0000-000000000000
## 11 00000000-0000-0000-0000-000000000000
## 12 00000000-0000-0000-0000-000000000000
## 13 00000000-0000-0000-0000-000000000000
## 14 00000000-0000-0000-0000-000000000000
## 15 00000000-0000-0000-0000-000000000000
## 16 00000000-0000-0000-0000-000000000000
## 17 00000000-0000-0000-0000-000000000000
## 18 00000000-0000-0000-0000-000000000000
## 19 00000000-0000-0000-0000-000000000000
## results.uri
## 1 nyt://book/00000000-0000-0000-0000-000000000000
## 2 nyt://book/00000000-0000-0000-0000-000000000000
## 3 nyt://book/00000000-0000-0000-0000-000000000000
## 4 nyt://book/00000000-0000-0000-0000-000000000000
## 5 nyt://book/00000000-0000-0000-0000-000000000000
## 6 nyt://book/00000000-0000-0000-0000-000000000000
## 7 nyt://book/00000000-0000-0000-0000-000000000000
## 8 nyt://book/00000000-0000-0000-0000-000000000000
## 9 nyt://book/00000000-0000-0000-0000-000000000000
## 10 nyt://book/00000000-0000-0000-0000-000000000000
## 11 nyt://book/00000000-0000-0000-0000-000000000000
## 12 nyt://book/00000000-0000-0000-0000-000000000000
## 13 nyt://book/00000000-0000-0000-0000-000000000000
## 14 nyt://book/00000000-0000-0000-0000-000000000000
## 15 nyt://book/00000000-0000-0000-0000-000000000000
## 16 nyt://book/00000000-0000-0000-0000-000000000000
## 17 nyt://book/00000000-0000-0000-0000-000000000000
## 18 nyt://book/00000000-0000-0000-0000-000000000000
## 19 nyt://book/00000000-0000-0000-0000-000000000000
## results.isbn13
## 1 9780307476463, 9780307593313, 9780307957023, 9780345802934, 9781446484197, 9781446484203, 9781455830497, 9781469258843, 9788483832967
## 2 9780375402517
## 3 9780517414712
## 4 9780679750536
## 5 9780307476463, 9780307593313, 9780307957023, 9780345802934, 9781446484197, 9781446484203, 9781455830497, 9781469258843, 9788483832967
## 6 9780385352109, 9780385352116, 9780804166737, 9780804170123
## 7 9781400044610
## 8 9780679420576
## 9 9784770016836
## 10 9780679446699
## 11 9780375704024
## 12 9780375411694
## 13 9781860469671
## 14 9781860469671
## 15 9781860469671
## 16 9780307265838
## 17 9780307269195, 9780307269478, 9780307373083, 9780307389831, 9781433243912
## 18 9781400079278
## 19 9780451494627