GithubHelp home page GithubHelp logo

drf-todo-api's Introduction

TODO Project with DRF and DRF Token Auth

This project is a simple TODO application built using Django Rest Framework (DRF) and DRF Token Authentication. It allows users to register, create, retrieve, update, and delete TODO items through a RESTful API.

Installation

  1. Clone the repository:
    git clone https://github.com/sarthak7509/DRF-TODO-API.git
  2. Navigate to the project directory:
    cd project-directory
  3. Create a virtual environment (optional, but recommended):
    python3 -m venv env
    source env/bin/activate
  4. Install the required packages:
    pip install -r requirements.txt
  5. Set up the database:
    python manage.py migrate
  6. Start the development server:
    python manage.py runserver

Endpoints

Alt Text The following endpoints are available in the API:

/api/register

  • Method: POST
  • Description: Register a new user in the system.
  • Request Body:
    • username: The username of the user.
    • password: The password of the user.
  • Response: Returns a JSON response with the user's details.

/api/Todo/

  • Method: GET

  • Description: Fetch all the TODO items.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Response: Returns a JSON response with all the TODO items.

  • Method: POST

  • Description: Create a new TODO item.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Request Body:

    • title: The title of the TODO item.
    • description: The description of the TODO item.
  • Response: Returns a JSON response with the newly created TODO item.

/api/TODO/{id}

  • Method: GET

  • Description: Retrieve a specific TODO item by its ID.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Response: Returns a JSON response with the TODO item matching the specified ID.

  • Method: PUT

  • Description: Update a specific TODO item by its ID.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Request Body:

    • title: The updated title of the TODO item.
    • description: The updated description of the TODO item.
  • Response: Returns a JSON response with the updated TODO item.

  • Method: PATCH

  • Description: Partially update a specific TODO item by its ID.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Request Body: Accepts the same parameters as the PUT method for updating.

  • Response: Returns a JSON response with the updated TODO item.

  • Method: DELETE

  • Description: Delete a specific TODO item by its ID.

  • Authorization: Token authentication required. Include the token in the request headers.

  • Response: Returns a JSON response indicating the successful deletion of the TODO item.

/api/Token/

  • Method: POST
  • Description: Log in a user and obtain an authentication token.
  • Request Body:
    • username: The username of the user.
    • password: The password of the user.
  • Response: Returns a JSON response with the authentication token.

To create or fetch a TODO item, the user must include the authentication token returned by /api/Token/ in the request headers under the Authorization

drf-todo-api's People

Contributors

sarthak7509 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.