A RESTful API for managing books, built with Flask, Flask-RESTful, SQLAlchemy, and secured with HTTP Basic Authentication.
⚡ Note: There is an explanation to install this API below for developers, however you don't need to install anything to try this API!
An online demo is available here: Live API Deployment (See below for usage instructions and example requests.)
- CRUD operations for book records
- Data validation for integrity
- Basic authentication for all endpoints
- Dockerized for easy deployment
Here is the default username and password for the authentication if you want to change this look for the "users" object in the app.py file.
- Username:
admin - Password:
password123
| Method | Endpoint | Description |
|---|---|---|
| GET | /books |
List all books |
| POST | /books |
Add a new book |
| GET | /books/<book_id> |
Get a specific book |
| PUT | /books/<book_id> |
Update a book |
| DELETE | /books/<book_id> |
Delete a book |
-
curl -u admin:password123 http://localhost:5000
-
curl -u admin:password123 -X POST http://localhost:500 \ -H "Content-Type: application/json" \ -d '{ "title": "The Pragmatic Programmer", "author": "Andrew Hunt", "published_year": 1999, "isbn": "9780201616224" }'
-
curl -u admin:password123 http://localhost:5000/books/<book_id>
-
curl -u admin:password123 -X PUT http://localhost:5000/books/<book_id> \ -H "Content-Type: application/json" \ -d '{ "title": "The Pragmatic Programmer (Updated)", "author": "Andrew Hunt", "published_year": 1999, "isbn": "9780201616224" }'
-
curl -u admin:password123 -X DELETE http://localhost:5000/books/<book_id>
-
git clone https://github.com/Eduardo-J-Morales/Books-Management-API.git cd Books-Management-API -
pip install -r requirements.txt
-
python app.py
Contributions are welcome! Please feel free to submit a Pull Request.