/algobulls-todo

https://ankitrout2903.pythonanywhere.com/

Primary LanguageJavaScript

Algobulls Todo API

Table of Contents

Getting Started

The API is available at https://algobulls-todo.onrender.com/

You can see the documentation at https://algobulls-todo.onrender.com/

Or you can run it locally

  1. Clone the repository
  2. Install the dependencies
pip install -r requirements.txt
  1. Run the server
python manage.py runserver
  1. The API is now available at http://localhost:8000/
  2. You can see the documentation at http://localhost:8000/
  3. You can also see the documentation at http://localhost:8000/

API Endpoints

Get a list of all the tasks

GET /api/tasks/

curl -X GET https://algobulls-todo.onrender.com/api/todos/ -u "username:password"

Create a new task

POST /api/tasks/

curl -X POST https://algobulls-todo.onrender.com/api/todos/ -u "username:password" -H "Content-Type: application/json" -d '{"title": "string", "description": "string", "status": "string", "due_date": "string", "tags": ["string"]}'

Get a task by id

GET /api/tasks/{id}/

curl -X GET https://algobulls-todo.onrender.com/api/todos/{id}/ -u "username:password"

Update a task by id

PUT /api/tasks/{id}/

curl -X PUT https://algobulls-todo.onrender.com/api/todos/{id}/ -u "username:password" -H "Content-Type: application/json" -d '{"title": "string", "description": "string", "status": "string", "due_date": "string", "tags": ["string"]}'

Delete a task by id

DELETE /api/tasks/{id}/

curl -X DELETE https://algobulls-todo.onrender.com/api/todos/{id}/ -u "username:password"

Authentication

Register a new user

POST /api/auth/register/

curl -X POST https://algobulls-todo.onrender.com/api/auth/register/ -H "Content-Type: application/json" -d '{"username": "string", "password": "string"}'

Table of Contents

  1. Introduction
  2. Authentication
  3. Endpoints

1. Introduction

This document provides detailed information about the RESTful API for the application available at https://ankitrout2903.pythonanywhere.com/.

2. Authentication

The API uses token-based authentication. To access secured endpoints, include the authentication token in the headers of your requests.

3. Endpoints

1. Register User

Endpoint

  • Method: POST
  • Path: /api/auth/register/

Request

  • Parameters: None

Request Body

{
  "username": "7mFeEYYHxY9u8.n",
  "password": "string"
}

Response

  • Status Code: 201 Created
  • Body:
{
  "id": 0,
  "username": "pQ6RIvu03pC6Zsx+Ws6ef87LvxwjEo0CmqCfeCqzehfhEtpHAk0AY.6AFsThgy9I5kFQkFNb4WhH6U0-qSxNZEGoA"
}

2. Get Todos

Endpoint

  • Method: GET
  • Path: /api/todos/

Request

  • Parameters: None

Response

  • Status Code: 200 OK
  • Body:
[
  {
    "id": 0,
    "title": "string",
    "description": "string",
    "status": "OPEN",
    "due_date": "2023-12-08T15:59:52.481Z",
    "timestamp": "2023-12-08T15:59:52.481Z",
    "tags": [
      "string"
    ]
  }
]

3. Create Todo

Endpoint

  • Method: POST
  • Path: /api/todos/

Request

  • Parameters: None

Request Body

{
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.482Z",
  "tags": [
    "string"
  ]
}

Response

  • Status Code: 201 Created
  • Body:
{
  "id": 0,
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.483Z",
  "timestamp": "2023-12-08T15:59:52.483Z",
  "tags": [
    "string"
  ]
}

4. Get Todo by ID

Endpoint

  • Method: GET
  • Path: /api/todos/{id}/

Request

  • Parameters:
    • id (integer) - A unique integer value identifying this todo.

Response

  • Status Code: 200 OK
  • Body:
{
  "id": 0,
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.484Z",
  "timestamp": "2023-12-08T15:59:52.484Z",
  "tags": [
    "string"
  ]
}

5. Update Todo

Endpoint

  • Method: PUT
  • Path: /api/todos/{id}/

Request

  • Parameters:
    • id (integer) - A unique integer value identifying this todo.

Request Body

{
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.486Z",
  "tags": [
    "string"
  ]
}

Response

  • Status Code: 200 OK
  • Body:
{
  "id": 0,
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.487Z",
  "timestamp": "2023-12-08T15:59:52.487Z",
  "tags": [
    "string"
  ]
}

6. Partially Update Todo

Endpoint

  • Method: PATCH
  • Path: /api/todos/{id}/

Request

  • Parameters:
    • id (integer) - A unique integer value identifying this todo.

Request Body

{
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.490Z",
  "tags": [
    "string"
  ]
}

Response

  • Status Code: 200 OK
  • Body:
{
  "id": 0,
  "title": "string",
  "description": "string",
  "status": "OPEN",
  "due_date": "2023-12-08T15:59:52.495Z",
  "timestamp": "2023-12-08T15:59:52.495Z",
  "tags": [
    "string"
  ]
}

7. Delete Todo

Endpoint

  • Method: DELETE
  • Path: /api/todos/{id}/

Request

  • Parameters:
    • id (integer) - A unique integer value identifying this todo.

Response

  • Status Code: 204 No Content