Skip to content

Bookup Rest API Documentation

ngatmaitan edited this page Dec 10, 2014 · 1 revision

This document describes the REST API and resources provided by kandelz to be used with BookUp.

Structure of the REST URIs

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

Index

This documents the current REST API provided by kandelz.

Resources

###/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

{ "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

parameter value description
email 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

{"success":true,"exists":true,"error":"The username is taken"}

###/API/index.php/validate/:email/:password

parameter value description
email 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

{"success":true,"valid":false,"error":"The combination is incorrect."}

###/API/index.php/isNewUser/:email

parameter value description
email 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

{"success":true,"valid":false,"error":"The combination is incorrect."}

###/API/index.php/addUser

parameter value description
email 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

###/API/index.php/getRecommendedBook/:email

parameter value description
email 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

{ "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

parameter value description
email 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

{ "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

parameter value description
email 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

{ "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

parameter value description
email 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

###/API/index.php/submitBookFeedback

parameter value description
email 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

###/API/index.php/removeBookFromReadingList

parameter value description
email 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

###/API/index.php/resetRatingsOfUser

parameter value description
email 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
Clone this wiki locally