This API is developed by using python flask. The key features of this API are :
- Built with pure python | Flask
- User authentication
- CRUD operations for book(s) & user(s)
- Test implementation with python's pytest
- In-Built Swagger Documentation
POST /signup
Parameter | Type | Description |
---|---|---|
username |
string |
*Required. Username |
email |
string |
*Required. Email-id |
password |
string |
*Required. Password |
POST /login
Parameter | Type | Description |
---|---|---|
email |
string |
*Required. Email-id |
password |
string |
*Required. Password |
PUT /update-dp
Parameter | Type | Description |
---|---|---|
image |
string($binary) |
*Required. Image |
PUT /update-user-info
Parameter | Type | Description |
---|---|---|
username |
string |
*Optional. Username |
email |
string |
*Optional. Email-id |
password |
string |
Optional. Password |
GET /user
Parameter | Type | Description |
---|---|---|
None |
None |
return current user info |
DELETE /delete-user
*Deletes current logged in user account/info from DB.
GET /logout
Parameter | Type | Description |
---|---|---|
None |
None |
log out current user |
POST /addbook
Parameter | Type | Description |
---|---|---|
title |
string |
*Required Title of the book |
description |
string |
*Required Description of the book |
priority |
number |
*Required Priority of the book |
status |
string |
*Required Current status of the book |
PUT /updatebook/{id}
Parameter | Type | Description |
---|---|---|
title |
string |
*Required Title of the book |
description |
string |
*Required Description of the book |
priority |
number |
*Required Priority of the book |
status |
string |
*Required Current status of the book |
GET /getbook/{id}
Returns (example):
{
"created_at": "2022-08-08 07:50:36.556437",
"description": "my book description",
"id": 14,
"priority": "2",
"status": "Available",
"time_since_published": "1:00:47.154837",
"title": "The gret title",
"updated_at": "2022-08-08 07:51:46.677554",
"user": "[email protected]"
}
DELETE /deletebook/{id}
*Deletes the book from DB (after permission check).
The Swagger API docs for the app can be accessed via
/api/docs
All the available features can be accessed at Swagge docs.
The test_users.py
& test_publishers.py
files contains all available unit tests
To run tests, use the following steps
STEP-1:
- start virtualenv and run the app.py (i.e flask app)
STEP-2:
- activate the same virtualenv in another shell/cmd window
- run `pytest -s test_users.py` command
- the test result(s) will be seen on console with response message(s)