This API provides endpoints for managing users, favorite shows, and watchlists for a TV show application.
- Clone the repository:
- Install the required dependencies:
- Set up the database:
- Run the application:
The API will be available at
http://localhost:5000/api
.
This API uses token-based authentication. To authenticate, include the token in the request headers:
- URL:
/api/register
- Method:
POST
- Data Params:
{ "username": "string", "email": "string", "password": "string", "usertype": "string" } * **Success Response:** * **Code:** 200 * **Content:** `{ "message": "Login successful", "token": "string" }`
- Error Response:
- Code: 200
- Content:
{ "message": "Invalid credentials!" }
- URL:
/api/user/<id>
- Method:
GET
- Success Response:
- Code: 200
- Content:
{ "id": "integer", "username": "string", "email": "string", "usertype": "string", "token": "string" } * **Error Response:** * **Code:** 200 * **Content:** `{ "message": "User not found!" }`
- URL:
/api/user/<id>
- Method:
DELETE
- Success Response:
- Code: 200
- Content:
{ "message": "User <id> deleted successfully!" }
- Error Response:
- Code: 200
- Content:
{ "message": "User not found!" }
- URL:
/api/user/delete
- Method:
DELETE
- Data Params:
{ "email": "string" }
- Success Response:
- Code: 200
- Content:
{ "message": "User with email <email> deleted successfully!" }
- Error Response:
- Code: 200
- Content:
{ "message": "User not found!" }
- URL:
/api/users
- Method:
GET
- Success Response:
- Code: 200
- Content: Array of user objects
- URL:
/api/favourites
- Method:
POST
- Data Params:
{ "useremail": "string", "showid": "integer", "addeddate": "datetime", "status": "string" }
- Success Response:
- Code: 200
- Content:
{ "message": "Show added to favourites!" }
- URL:
/api/watchlist
- Method:
POST
- Data Params:
{ "useremail": "string", "showid": "integer", "addeddate": "datetime", "status": "string" }
- Success Response:
- Code: 200
- Content:
{ "message": "Show added to watchlist!" }
- URL:
/api/userdetails/<id>
- Method:
GET
- Success Response:
- Code: 200
- Content:
{ "bio": "string" }
- Error Response:
- Code: 200
- Content:
{ "message": "User details not found!" }
- id: Integer (Primary Key)
- username: String (Unique, Not Null)
- email: String (Unique, Not Null)
- password: String (Not Null)
- usertype: String (Not Null)
- token: String (Unique)
- id: Integer (Primary Key)
- useremail: String (Foreign Key to User.email, Not Null)
- showid: Integer (Not Null)
- addeddate: DateTime (Not Null)
- status: String (Not Null)
- id: Integer (Primary Key)
- useremail: String (Foreign Key to User.email, Not Null)
- showid: Integer (Not Null)
- addeddate: DateTime (Not Null)
- status: String (Not Null)
- id: Integer (Primary Key)
- user_id: Integer (Foreign Key to User.id, Not Null)
- bio: Text (Nullable)
The API returns JSON responses for errors. Most endpoints return a "message" field with a description of the error.
Currently, there are no rate limiting restrictions implemented for this API.