/TechQuiz_API

TechQuiz API build using Django-rest-Framework

Primary LanguagePython

TechQuiz API

It is a technical quiz API, build purely using Python (programming language), Django and Django-Rest-Framework (opensource framework written in python).

Current Features

Listing the features of the API

  • Custom User Model (with email and username as unique mandatory fields)
  • Profile Model (auto-created when user register using signals)
  • One-To-One Relationship b/w Custom-User and Profile Model
  • JWT (Json-Web-Token) Authentication
  • Authenticated users can only update their own User Profile

API EndPoints

API Endpoints defines the structure of the API and how end users access data from our application using the HTTP methods - GET, POST, PUT, DELETE.

Endpoint HTTP Method CURD Method Result
user POST CREATE Create a new user
search/<user_name> GET READ Get a user profile
token POST CREATE Create access & refresh token
token/refresh POST CREATE Get new access token
profile/<user_name> GET, PUT, PATCH READ & UPDATE Get a user profile and update your profile
  • User Registration (Creating a New User)

    • POST http://localhost:8000/api/v1/user/
      • Body
        {
            "email": "testuser2@gmail.com",
            "user_name": "testuser2",
            "password": "testuser2"
        }
        
  • Search Profiles

    • GET http://localhost:8000/api/v1/search/testuser2
      • Response
        {
            "id": 3,
            "user": {
                "user_name": "testuser2",
                "email": "testuser2@gmail.com"
            },
            "about": "Hello, I am testuser2.",
            "location": "India",
            "birth_date": "2021-01-01",
            "gender": "Male"
        }
        
  • Access Token/Refresh Token

    • POST http://localhost:8000/api/v1/token/
      • Body
        {
            "email": "testuser2@gmail.com",
            "password": "testuser2"
        }   
        
  • Refresh Token

    • POST http://localhost:8000/api/v1/token/refresh/
      • Body
        {
            "email": "testuser2@gmail.com",
            "password": "testuser2",
            "refresh": <your-refresh-token>
        }
        
  • User Profile (Required Access Token for Authentication)

    • GET http://localhost:8000/api/v1/profile/testuser1
      • Response
        {
            "id": 5,
            "about": "Hello, I am modified testuser1.",
            "location": "India",
            "birth_date": "2020-01-11",
            "gender": "Male"
        }
        
    • PUT http://localhost:8000/api/v1/profile/testuser1/
      • Body
        {
            "about": "Hello, I am testuser1.",
            "location": "Australia",
            "birth_date": "2020-01-11",
            "gender": "Male"
        }
        
    • PATCH http://localhost:8000/api/v1/profile/testuser1/
      • Body
        {  
            "location": "India",
            "birth_date": "2020-01-21"
        }
        

Upcoming Features

Listing the upcoming features of the API

  • Create Tech Quiz Model
  • Tech Quiz Model API Endpoints
  • User can delete own account
  • User can create Tech Quiz
  • View TestCase