This project is a Django-based Referral System API that allows users to register, view their details, and view their referrals. The API is built using Django Rest Framework and is designed to be easily deployable using Docker.
- User Registration Endpoint
- User Details Endpoint
- Referrals Endpoint
- Token-based Authentication
- Docker & Docker Compose for easy deployment
- Unit tests for each endpoint
- Well-documented API endpoints
- Clone the repository:
https://github.com/jay-chhaniyara/referral_system_api_task.git cd referral_system_api_task - Create a Python virtual environment:
python3 -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
- Install dependencies:
pip install -r requirements.txt
- Apply database migrations:
python manage.py migrate
- Run the development server:
python manage.py runserver
- URL:
/api/register/ - Method:
POST - Description: Register a new user.
- Request Body:
{ "name": "Test Name", "email": "test@example.com", "password": "password123", "referral_code": "ABCD1234" }
- URL:
/api/login/ - Method:
POST - Description: Login to the system to obtain an authentication token
- Request Body:
{ "email": "test@example.com", "password": "password123", }
- URL:
/api/user-details/ - Method:
GET - Description: Get details of the authenticated user.
- Headers: Authorization: Bearer
<token>
- URL:
/api/referrals/ - Method:
GET - Description: Get referrals users list of the authenticated user.
- Headers: Authorization: Bearer
<token>