This is a simple Flask application that serves as a RESTful API for managing a library of books. The application uses SQLite as its database and SQLAlchemy.
pip install flask flask-sqlalchemy
git clone https://github.com/lithV/libraryApi
cd libraryApi
python app.py
Returns a list of 'Book' objects in a JSON.
Create a new Book. Expects a Book object in the request body. Returns status 200 if all inputs validated with a JSON containing ID of the book added. 400 otherwise.
Update an existing book. Expects a Book object in the request body. 200 if successful, 400 otherwise.
{
"book_name": "Name of Book",
"author_name": "Name of Author"
}
[
{
"author_name": "Robert Frost",
"book_id": 1,
"book_name": "Percy Jackson"
},
{
"author_name": "JK Rowling",
"book_id": 2,
"book_name": "Harry Potter"
},
{
"author_name": "JK Rowling",
"book_id": 3,
"book_name": "Harry Potter and the Prisoner of Azkaban"
},
{
"author_name": "Adarsh Singh",
"book_id": 4,
"book_name": "Battle Havens"
}
]
{
"book_id": "Book ID"
}