-
Notifications
You must be signed in to change notification settings - Fork 4
API
The below API's are used to fetch the details from database and return it to the calling API so that data in FRONTEND can be rendered based on the data stored in BACKEND
- Get Genre API
- Get Particular Genre API
- Get Books based on Genre
- Insert Books into Database
- API to return Book Details by ID
- API to post book reviews
- API to fetch book reviews
- API to fetch ratings of a book by ID
- API to Fetch the Top 5 books for a Given Genre
- API to Register User
- API to authenticate a user login
- API to add a book to users wishlists
The Postman commands and sample examples can be viewed here : https://documenter.getpostman.com/view/19432934/UVeGqRHi
Method : GET
This getGenres API is used to fetch all the Genres Present in The Genres Table from the Database.
Sample API and Sample Output
Sample Output :
Sample Demo :
Method : GET The getGenres/{id} API is used to fetch a particular Genre from the database based on the Genre ID requested from the frontend Webpage.
Sample API and Sample Output
Sample Demo :
Method Type: POST API will receive a POST request from the body in JSON format. This JSON is Decoded to a struct type Book and insert the values into database books.db books table as per the user's request.
Sample API usage via POSTMAN
After the insertion API will return values in JSON format of the information inserted in DB and the ID generated for the book.
Sample Demo :
Method : GET API will receive a request with Genre ID query in URL string and returns a array of all the books in DB tagged with the requested Genre ID in JSON format.
Sample API usage via POSTMAN
Sample Demo :
Method : GET The /api/getBook API is used to fetch a particular Book by its ID as requested from the frontend Webpage.
Sample API usage and Output
Method Type: POST API will receive a POST request from the body in JSON format. This JSON is Decoded to a struct type Reviews and insert the values into database books.db books table as per the user's request.
- It will insert the review datas to Review table as and when any user writes Reviews about the book.
- It also calculates the review and ratin g count and increments it in the Book Table.
Sample API usage via POSTMAN
After the insertion API will return values in JSON format of the information inserted in DB and the ID generated for the book review.
Method Type: GET API will receive a GET request from the body in JSON format. This JSON is Decoded to a struct type Review and insert the values into database books.db books table as per the user's request. This API returns top 10 the reviews for that particular BookID. And based on the Review-Index, it returns the next 10 revies starting from index number Review-index
Sample API usage via POSTMAN
Method Type: GET API will receive a GET request from the body in JSON format. This JSON is Decoded to a struct type Book and insert the values into database books.db books table as per the user's request.
Sample API usage via POSTMAN
Method Type: GET The /fetchTopBooksForGenre?id=5 API is used to fetch the top 5 Books for any given Genre ID
Sample API usage and Output
Method Type : POST This API is to register a new user account.
Sample API usage and output
Method Type : POST This api will authenticate users email and password and return a json body that contains the status(true / false).
Sample API usage and output
Method Type : POST
This api will associate book ids when a user adds a book to his/her wishlist based on users id.
Sample API usage and output