Skip to content

Mohit-1/ReferralAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ReferralAPI

An API to implement referrals to users based on their email address.

Pre-requisites -

Python 3.7.0 or higher

OS - Windows

Installation instructions -

  1. Clone the repository

  2. Install 'virtualenv' to create a virtual environment for our API

    pip install virtualenv

  3. Setup the virtual environment

    virtualenv sample_name_for_virtual_env

  4. Activate the virtual environment

    sample_name_for_virtual_env\Scripts\activate

  5. Install the dependencies

    pip install -r requirements.txt

  6. Set up the database (first change to the ReferralAPI directory)

    python manage.py makemigrations

    python manage.py migrate

  7. Create a superuser

    python manage.py createsuperuser

  8. Run the server (on localhost:8000)

    python manage.py runserver

API reference -

End point - api/referral_code?user_id=

Query parameter(s) - user_id

Methods allowed - GET

   Returns a unique 6 digit referral code for the user passed in the query parameter.

End point - api/referral?referral_code=&referred_email=

Query parameter(s) - referral_code, referred_email

Methods allowed - POST, DELETE

  Creates/Deletes a referral for the provided referral_code (from the referrer) 

  and the referred_email (email of the recipient of the reference) after performing some basic checks.

End point - api/conversion?referral_code=&email=

Query parameter(s) - referral_code, email

Body (Request) - username (content-type : JSON)

Methods allowed - POST

  Converts the reference into an active user of the application.

About

An API to implement referrals to users based on their email address.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages