Page:Aaron Swartz s A Programmable Web An Unfinished Work.pdf/47

'''5. BUILDING A PLATFORM: PROVIDING APIS 35''' force the server to return HTML while

http://books.example.org/b/3j7is.json

always returns JSON. (And then you could have:

http://books.example.org/b/3j7is.json?callback=myCallback to support JSONP.)

Alright, let’s get concrete. What might one of these JSON pages look like? Let’s stick with our book example for a moment. You could imagine a book page looking something like:

>   {

>     ’id’: ’3j7is’,

>     ’title’: ’The ABC book’,

>     ’by_statement’: ’designed and cut on wood,

>     by C. B. Falls.’,

>     ’pagination’: ’˜cite{bib30} p. incl. col. illus.’,

>     ’description’: “An all-time favorite and a classic in its ﬁeld, this big and beautiful ABC book by distinguished artist C. B. Falls has been making new friends with delighted children for over forty years.

Mr. Falls designed the book for his little three-year-old daughter who likes a big book with lots of pictures. The drawings are cut on wood blocks and printed from fourcolor plates, and the artist has personally superintended the reproduction of them. The imagination of a child or grown-up is left free to capture by its own thrill of recognition the familiar in a new-old medium where color has not obscured the outline nor played too many tricks with nature.,”

>     ’publisher’: ’Doubleday, Page & company’,

>     ’authors’: [

>     {’id’: ’OL115179A’, ’name’: ’C. B. Falls’}