-
Notifications
You must be signed in to change notification settings - Fork 0
Bookup Rest API Documentation
This document describes the REST API and resources provided by kandelz to be used with BookUp.
URIs for the BookUp REST API resource have the following structure: http://host:port/API/index.php/resource-name
Example: http://ec2-54-187-70-205/API/index.php/validate/[email protected]/Candles
This documents the current REST API provided by kandelz.
-
Resources
- /API/index.php/getPopularBooks
- /API/index.php/userExists/:email
- /API/index.php/validate/:email/:password
- /API/index.php/isNewUser/:email
- /API/index.php/addUser
- /API/index.php/getRecommendedBook/:email
- /API/index.php/getRandomBook
- /API/index.php/getReadingList/:email
- /API/index.php/addBookToReadingList
- /API/index.php/submitBookFeedback
- /API/index.php/removeBookFromReadingList
- /API/index.php/resetRatingsOfUser
###/API/index.php/getPopularBooks
-
Returns 10 popular books from a pre-populated Popular Book list
-
Example URI:
-
type: GET
-
Input: None
-
Output: JSON array of Book objects
-
Available response representations
- 404
- Returned if URI is misspelled or if not connected to server
- 200 OK
- 404
-
{ "books": [ { "title": "Fahrenheit 451", "author": "Ray Bradbury", "description": "The terrifyingly prophetic novel of a post-literate future Guy Montag is a fireman. His job is to destroy the most illegal of commodities, the source of all discord and unhappiness, the printed book.", "isbn": "9780007491568", "thumbnail": "http://bks8.books.google.com/books?id=HDvHjwEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api" }, ... ], "success": true }
###/API/index.php/userExists/:email
- Checks to see if the user exists
- Example URIs:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
-
Output: whether or not the user exists
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- 404
-
{"success":true,"exists":true,"error":"The username is taken"}
###/API/index.php/validate/:email/:password
- Checks to see if the user and password combination is correct
- Example URIs:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user | |
password | string | the password of a user |
-
Output: whether or not the user and password combination is correct
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameters are not given
- 200 OK
- 404
-
{"success":true,"valid":false,"error":"The combination is incorrect."}
###/API/index.php/isNewUser/:email
- Checks to see if the user is new
- Example URIs:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
-
Output: whether or not the user is new
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- 404
-
{"success":true,"valid":false,"error":"The combination is incorrect."}
###/API/index.php/addUser
- Adds user to the database
- Example URI:
- type: POST
- Input:
parameter | value | description |
---|---|---|
string | the email of a user | |
password | string | the password of a user |
- Output: none
- Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameters are not given
- 200 OK
- Returned if successful
- 404
###/API/index.php/getRecommendedBook/:email
- Gets a Recommended Book from FireBase
- Example URI:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
-
Output: JSON of book object
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- 404
-
{ "books": [ { "title": "The bad beginning", "author": "Lemony Snicket", "description": "Second copy.", "isbn": "9780439206471", "thumbnail": "http://bks9.books.google.com/books?id=qaViKziA-E0C&printsec=frontcover&img=1&zoom=1&source=gbs_api" } ], "success": true }
###/API/index.php/getRandomBook
- Gets a Recommended Book from FireBase
- Example URI:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
-
Output: JSON of book object
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- 404
-
{ "books": [ { "title": "The bad beginning", "author": "Lemony Snicket", "description": "Second copy.", "isbn": "9780439206471", "thumbnail": "http://bks9.books.google.com/books?id=qaViKziA-E0C&printsec=frontcover&img=1&zoom=1&source=gbs_api" } ], "success": true }
###/API/index.php/getReadingList/:email
- Get a user's reading list
- Example URI:
- type: GET
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
-
Output: JSON array of book objects
-
Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- 404
-
{ "books": [ { "title": "The Artemis Fowl: Time Paradox", "author": "Eoin Colfer", "description": "When the only way to save his mother's life lies with the lemurs he made extinct five years ago, Artemis turns to his fairy friends to take him back in time, where he tries to undo the damage while avoiding his dangerous younger self.", "isbn": "9781423108368", "thumbnail": "http://bks9.books.google.com/books?id=iKKhPQAACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api" }, ... ], "success": true }
###/API/index.php/addBookToReadingList
- Add's a book to a user's reading list
- Example URI:
- type: POST
- Input:
parameter | value | description |
---|---|---|
string | the email of a user | |
isbn | string | the isbn of a book |
- Output: none
- Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameters are not given
- 200 OK
- Returned if successful
- 404
###/API/index.php/submitBookFeedback
- Add a book and a user rating to Rating
- Example URI:
- type: POST
- Input: email, rating, isbn
parameter | value | description |
---|---|---|
string | the email of a user | |
rating | int | user's rating (-1, 0, 1) |
isbn | string | the isbn of a book |
- Output: none
- Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameters are not given
- 200 OK
- Returned if successful
- 404
###/API/index.php/removeBookFromReadingList
- Remove Book from a user's Reading List
- Example URI:
- type: POST
- Input:
parameter | value | description |
---|---|---|
string | the email of a user | |
isbn | string | the isbn of a book |
- Output: none
- Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameters are not given
- 200 OK
- Returned if successful
- 404
###/API/index.php/resetRatingsOfUser
- Remove ratings of a particular user
- Example URI:
- type: POST
- Input:
parameter | value | description |
---|---|---|
string | the email of a user |
- Output: none
- Available response representations
- 404
- Returned if URI is misspelled, not connected to server, or if parameter is not given
- 200 OK
- Returned if successful
- 404