The Cricket Match Management API is a Flask-based web application designed to manage cricket match data, teams, players, and more. It provides endpoints for registering admin users, managing matches, and retrieving match schedules.
-
Clone the repository to your local machine:
git clone https://github.com/yourusername/workindia.git
-
Install the required dependencies using pip:
pip install -r requirements.txt
-
Configure the database connection and secret key in
app.py
:app.config['SQLALCHEMY_DATABASE_URI'] = 'your_database_uri_here' app.config['SECRET_KEY'] = 'your_secret_key_here'
-
Run the application:
python app.py
-
Endpoint: [POST]
/api/admin/signup
-
Request Data:
{ "username": "example_user", "password": "example_password", "email": "[email protected]" }
-
Response Data:
{ "status": "Admin Account successfully created", "status_code": 200, "user_id": "12345" }
-
Endpoint: [POST]
/api/admin/login
-
Request Data:
{ "username": "example_user", "password": "example_password" }
-
Successful Login Response:
{ "status": "Login successful", "status_code": 200, "user_id": "12345", "access_token": "your_access_token_here" }
-
Failure Response:
{ "status": "Incorrect username/password provided. Please retry", "status_code": 401 }
-
Endpoint: [POST]
/api/matches
-
Headers:
{ "Authorization": "Bearer your_access_token_here" }
-
Request Data:
{ "team_1": "India", "team_2": "Australia", "date": "2023-07-12", "venue": "Sydney Cricket Ground" }
-
Response Data:
{ "message": "Match created successfully", "match_id": "3" }
-
Endpoint: [GET]
/api/matches
-
Request Data: None
-
Response Data:
{ "matches": [ { "match_id": "1", "team_1": "India", "team_2": "England", "date": "2023-07-10", "venue": "Lord's Cricket Ground" }, { "match_id": "2", "team_1": "Australia", "team_2": "New Zealand", "date": "2023-07-11", "venue": "Melbourne Cricket Ground" } // Add more matches here ] }
-
Endpoint: [POST]
/api/teams/{team_id}/squad
-
Request Data:
{ "name": "Rishabh Pant", "role": "Wicket-Keeper" }
-
Response Data:
{ "message": "Player added to squad successfully", "player_id": "789" }
The API uses a PostgreSQL database to store user, team, player, match, and player statistics data. You can configure the database connection in the app.py
file.
Authentication is implemented using JWT (JSON Web Tokens). Admin users receive access tokens upon login, which are required to access admin-only endpoints.
Contributions to the Cricket Match Management API are welcome! You can contribute by opening issues, creating pull requests, or suggesting improvements.
This project is licensed under the MIT License. See the LICENSE file for details.