- The Book Catalog is a web application that allows reading, writing, updating, and deleting books, genres, and authors.
- It provides HTML forms and REST API to perform these actions on stored data.
- The application also offers an opportunity to search books by published dates in API and Forms.
A book is an entity that has the following attributes:
id (int)
Title (string)
Author
Genre
Publication date (date)
Description (string)
A genre is an entity that has the following attributes:
id (int)
Name (string)
Description (string)
An author is an entity that has the following attributes:
id (int)
Name (string)
Bio (string)
The first page of the application greets the user and provides navigation on the page. The navigation bar is the same for all application pages except for API.
The page is designed to list all the books and filter them by publishing date with a user-provided date range.
- User selects item "Books";
- Application displays the list of the books (up to 10 items on each page);
- To see the next 10 records of the books in the database, the user needs to click the "Next" button (below the records in the pagination block) or the following number of the page the user wants to see.
- User specifies dates range in the specific input forms above data;
- User hits the refresh button to the right from dates inputs;
- The application displays the list of books with publication dates in the user-provided dates range.
The list displays the following columns:
- id - unique book number
- Title
- Author
- Genre
- Publication date
- User clicks on the "Title" of the specific book from the list on the book list page;
- Application displays the user-chosen book details;
On book details page the application displays the following columns:
- id - unique book number
- Title
- Author
- Genre
- Description
- Publication date
The creation page is designed to create a record of the new book in the database.
- User clicks the "Create new" button in the book list page;
- Application displays form to enter book data;
- User enters book data and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then record is adding to database;
- If error occurs, then error message is displaying;
- If new book record is successfully added, then list of books with added records is displaying.
- User clicks the "Create new" button in the book list page;
- Application displays form to enter book data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t save in the database, then a list of books records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be saved to the database, and the corresponding form with updated data will be opened.
When creating a new book, the following details are entered:
- Title
- Author
- Genre
- Description
- Publication date
The edit page is designed to edit an existing book record in the database.
- User clicks the "Update" button (to the right from the book he/she wants to update) on the book list/details page;
- Application displays form to enter book data;
- User enters book data he/she wants to update and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then the book is updated in the database;
- If an error occurs, then the error message is displayed;
- If a new book record is successfully updated, then the list of the books with updated records is displayed.
- User clicks the "Update" button (to the right from the book he/she wants to update) on the book list/details page;
- Application displays form to enter book data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t update in the database, then a list of books records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be update in the database, and the corresponding form with updated data will be opened.
When editing a book, the following details are entered:
- Title
- Author
- Genre
- Description
- Publication date
- User clicks the "Delete" button (to the right from the book he/she wants to delete) on the book list/details page;
- Application displays a dialog page to confirm destroying the record for chosen book;
- User confirms deletion by pressing "Confirm" button.
- User clicks the "Delete" button (to the right from the book he/she wants to delete) on the book list/details page;
- Application displays a dialog page to confirm destroying the record for chosen book;
- User presses “Cancel” button;
- Data doesn’t delete in the database, then a list of books records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be deleted from the database, and the corresponding form with updated data will be opened.
The page is designed to list all the genres.
- User selects item "Genres";
- Application displays the list of the genres (up to 10 items on each page);
- To see the next 10 records of the genres in the database, the user needs to click the "Next" button (below the records in the pagination block) or the following number of the page the user wants to see.
The list displays the following columns:
- id - unique genre number
- Name
- Description
- User clicks on the "Name" of the specific genre from the list on the genre list page;
- Application displays the user-chosen genre details;
On genre details page the application displays the following columns:
- id - unique genre number
- Name
- Description
The creation page is designed to create a record of the new genre in the database.
- User clicks the "Create new" button in the genre list page;
- Application displays form to enter book data;
- User enters book data and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then record is adding to database;
- If error occurs, then error message is displaying;
- If new genre record is successfully added, then list of genres with added records is displaying.
- User clicks the "Create new" button in the genre list page;
- Application displays form to enter genre data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t save in the database, then a list of genres records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be saved to the database, and the corresponding form with updated data will be opened.
When creating a new genre, the following details are entered:
- Name
- Description
The edit page is designed to edit an existing genre record in the database.
- User clicks the "Update" button (to the right from the genre he/she wants to update) on the genre list/details page;
- Application displays form to enter genre data;
- User enters genre data he/she wants to update and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then the genre is updated in the database;
- If an error occurs, then the error message is displayed;
- If a new genre record is successfully updated, then the list of the genres with updated records is displayed.
- User clicks the "Update" button (to the right from the genre he/she wants to update) on the genre list/details page;
- Application displays form to enter genre data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t update in the database, then a list of genres records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be update in the database, and the corresponding form with updated data will be opened.
When editing a genre, the following details are entered:
- Name
- Description
- User clicks the "Delete" button (to the right from the genre he/she wants to delete) on the genre list/details page;
- Application displays a dialog page to confirm destroying the record for chosen genre;
- User confirms deletion by pressing "Confirm" button.
- User clicks the "Delete" button (to the right from the genre he/she wants to delete) on the genre list/details page;
- Application displays a dialog page to confirm destroying the record for chosen genre;
- User presses “Cancel” button;
- Data doesn’t delete in the database, then a list of genres records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be deleted from the database, and the corresponding form with updated data will be opened.
The page is designed to list all the authors.
- User selects item "Authors";
- Application displays the list of the authors (up to 10 items on each page);
- To see the next 10 records of the authors in the database, the user needs to click the "Next" button (below the records in the pagination block) or the following number of the page the user wants to see.
The list displays the following columns:
- id - unique author number
- Name
- Bio - author's biography
- User clicks on the "Title" of the specific author from the list on the author list page;
- Application displays the user-chosen author details;
On author details page the application displays the following columns:
- id - unique author number
- Name
- Bio - author's biography
The creation page is designed to create a record of the new author in the database.
- User clicks the "Create new" button in the author list page;
- Application displays form to enter book data;
- User enters book data and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then record is adding to database;
- If error occurs, then error message is displaying;
- If new author record is successfully added, then list of authors with added records is displaying.
- User clicks the "Create new" button in the author list page;
- Application displays form to enter author data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t save in the database, then a list of authors records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be saved to the database, and the corresponding form with updated data will be opened.
When creating a new author, the following details are entered:
- Name
- Bio - author's biography
The edit page is designed to edit an existing author record in the database.
- User clicks the "Update" button (to the right from the author he/she wants to update) on the author list/details page;
- Application displays form to enter author data;
- User enters author data he/she wants to update and presses "Submit" button;
- If any data is entered incorrectly, incorrect data messages are displayed;
- If entered data is valid, then the author is updated in the database;
- If an error occurs, then the error message is displayed;
- If a new author record is successfully updated, then the list of the authors with updated records is displayed.
- User clicks the "Update" button (to the right from the author he/she wants to update) on the author list/details page;
- Application displays form to enter author data;
- User may start entering the data into the form fields;
- Before pressing "Submit" button user presses “Cancel” button;
- Data doesn’t update in the database, then a list of authors records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be update in the database, and the corresponding form with updated data will be opened.
When editing a author, the following details are entered:
- Name
- Bio - author's biography
- User clicks the "Delete" button (to the right from the author he/she wants to delete) on the author list/details page;
- Application displays a dialog page to confirm destroying the record for chosen author;
- User confirms deletion by pressing "Confirm" button.
- User clicks the "Delete" button (to the right from the author he/she wants to delete) on the author list/details page;
- Application displays a dialog page to confirm destroying the record for chosen author;
- User presses “Cancel” button;
- Data doesn’t delete in the database, then a list of authors records is displayed to the user;
- If the user selects the menu item "Books”, "Genres”, "Authors", "Home" or "API", the data will not be deleted from the database, and the corresponding form with updated data will be opened.
GET /api/v1/books: Retrieve a list of all books
GET /api/v1/books/<book_id>: Retrieve a specific book by ID
POST /api/v1/books: Create a new book
PUT /api/v1/books/<book_id>: Update a specific book by ID
DELETE /api/v1/books/<book_id>: Delete a specific book by ID
Retrieve a list of books published after or before or between the given dates. (The date format should be in yyyy-mm-dd):
GET /api/v1/books?before_date=<date>
GET /api/v1/books?after_date=<date>
GET /api/v1/books?after_date=<date>&before_date=<date>
GET /api/v1/genres: Retrieve a list of all genres
GET /api/v1/genres/<genre_id>: Retrieve a specific genre by ID
POST /api/v1/genres: Create a new genre
PUT /api/v1/genres/<genre_id>: Update a specific genre by ID
DELETE /api/v1/genres/<genre_id>: Delete a specific genre by ID
GET /api/v1/authors: Retrieve a list of all authors
GET /api/v1/authors/<author_id>: Retrieve a specific author by ID
POST /api/v1/authors: Create a new author
PUT /api/v1/authors/<author_id>: Update a specific author by ID
DELETE /api/v1/authors/<author_id>: Delete a specific author by ID
The Book Catalog API returns data in JSON format. A typical response for a successful request (empty response body for 204 response code, deletion) will have the following structure:
json:
{
...
}
In case of an error, the response will have the following structure:
json for single message:
{
"message": "Error message"
}
json for multiple messages:
{
"message": {
"error1": [
"message"
],
"error2": [
"message"
]
}
}
The GET /books, GET /genres and GET /authors endpoints support pagination. By default, the API returns the first 10 items. The client can specify the number of items to return using the limit query parameter, and the starting point using the offset query parameter.
The Book Catalog API uses versioning to ensure that client applications are not impacted by changes to the API. The API version is specified in the URL, e.g. /v1/books.