Client Side

Book Data API Documentation


A Node.js web server that both hosts static files such as HTML, and hosts a backend web API from a JSON file about books.



Get All Books

GET
HEAD


Query Params
None!
Returns
A JSON array of book information in a JSON "pretty" format
Examples

                "books": [
                {
                    "author": "Chinua Achebe",
                    "country": "Nigeria",
                    "language": "English",
                    "link": "https://en.wikipedia.org/wiki/Things_Fall_Apart\n",
                    "pages": 209,
                    "title": "Things Fall Apart",
                    "year": 1958,
                    "genres": [
                        "Historical Fiction",
                        "Postcolonial Literature"
                        ]
                },
                {
                    "author": "Hans Christian Andersen",
                    "country": "Denmark",
                    "language": "Danish",
                    "link": "https://en.wikipedia.org/wiki/Fairy_Tales_Told_for_Children._First_Collection.\n",
                    "pages": 784,
                    "title": "Fairy tales",
                    "year": 1836,
                    "genres": [
                        "Fairy Tales",
                        "Children's Literature"
                        ]
                }, ...
                


Find Books by Author

Query Params
Author [string]
Returns
A JSON book array in a JSON "pretty" format
Examples
Paul Celan ->

                    {
                        "book": {
                        "author": "Paul Celan",
                        "country": "Romania, France",
                        "language": "German",
                        "link": "\n",
                        "pages": 320,
                        "title": "Poems",
                        "year": 1952,
                        "genres": [
                            "Poetry",
                            "Existentialism"
                            ]
                        }
                    }
                


Find Books by Title

Query Params
Title [string]
Returns
A JSON book array in a JSON "pretty" format
Examples
The Epic Of Gilgamesh ->

                    {
                        "author": "Unknown",
                        "country": "Sumer and Akkadian Empire",
                        "language": "Akkadian",
                        "link": "https://en.wikipedia.org/wiki/Epic_of_Gilgamesh\n",
                        "pages": 160,
                        "title": "The Epic Of Gilgamesh",
                        "year": -1700,
                        "genres": [
                            "Epic Poetry",
                            "Mythology"
                            ]
                    }
                


Find Books by Year

Query Params
Year [integer]
Returns
A JSON book array in a JSON "pretty" format
Examples
1200 ->

                    {
                        "author": "Unknown",
                        "country": "India/Iran/Iraq/Egypt/Tajikistan",
                        "language": "Arabic",
                        "link": "https://en.wikipedia.org/wiki/One_Thousand_and_One_Nights\n",
                        "pages": 288,
                        "title": "One Thousand and One Nights",
                        "year": 1200,
                        "genres": [
                            "Folk Tales",
                            "Mythology"
                            ]
                    }
                


Add a Book

Query Params
                    Author [string]
                    Country [string]
                    Language [string]
                    Link [string]
                    Pages [integer]
                    Title [string]
                    Year [integer]
                    Genre [string]
                
Returns
POST Status Code; If successful will update JSON database with new book
Examples

                    Status: 400
                    {"message":"Author, country, language, link, pages, title, year, genres are all required.","id":"missingParams"}

                


                    Status: 201
                    {"message":"Created Successfully"}
                


Edit a Book by Title

Query Params
                    Author [string]
                    Country [string]
                    Language [string]
                    Link [string]
                    Pages [integer]
                    Title [string]
                    Year [integer]
                    Genre [string]
                
Returns
POST Status Code; If successful will update JSON database with new information
Examples

                   Status: 201
                    {"message":"Created Successfully"}
                


                    Status: 400
                    {"message":"A book of title 'sdf' does not exist","id":"doesNotExist"}