Skip to content

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ToDoList API

The Todo_List Django Web App offers the following features:

  • User Authentication
  • ToDo List

How to run the Project

Create a virtual environment

virtualenv myenv

Activate the virtual environment

source myenv/bin/activate

Migrate the Database

python manage.py makemigrations
python manage.py migrate

Create Superuser

python manage.py createsuperuser

To run the project

python manage.py runserver

How to access each API, with examples and sample response

User Authentication

Register

url
 http://127.0.0.1:8000/api/auth/register
Sample Input
{   "username":"Nirmal",
    "email":"nirmal@gmail.com",
    "password":"12345"
}
Sample Output
{
    "status": "success",
    "code": 201,
    "details": {
        "username": "Nirmal",
        "email": "nirmal@gmail.com",
        "password": "12345"
    }
}

Login

url
 http://127.0.0.1:8000/api/auth/login
Sample Input
{
    "username": "Nirmal",
    "password": "12345"
}
Sample Output
{
    "token": "52b22533d658d285c506ace40ef5407f67111734"
}

LogOut

url
 http://127.0.0.1:8000/api/auth/logout
Sample Input
Authorization : Token <token>
Sample Output
{
    "message": "Successfully logged out."
}

ToDo List

Category

1. To list

url
http://127.0.0.1:8000/categorylist/
Sample Input
Authorization : Token <token>
Sample Output
[
    {
        "id": 1,
        "title": "Personal",
        "time": "2024-03-06T10:44:39.227548Z",
        "created_date": "2024-03-06T10:44:39.228912Z",
        "created_by": 4
    },
    {
        "id": 2,
        "title": "Study",
        "time": "2024-03-06T11:48:31.761510Z",
        "created_date": "2024-03-06T11:48:31.761510Z",
        "created_by": 4
    }
]

2. To Create

url
http://127.0.0.1:8000/categorycreate/
Sample Input
Authorization : Token <token>
{
  "title":"Sample Title"
}
Sample Output
{
    "id": 6,
    "title": "Sample Title",
    "time": "2024-03-07T11:53:36.322168Z",
    "created_date": "2024-03-07T11:53:36.323171Z",
    "created_by": 4
}

3. To get the details in each Category

url
http://127.0.0.1:8000/categorydetails/<str:pk>/
Sample Input
Authorization : Token <token>
Sample Ouput
{
    "id": 2,
    "title": "Study",
    "time": "2024-03-06T11:48:31.761510Z",
    "created_date": "2024-03-06T11:48:31.761510Z",
    "created_by": 4
}

4.To update

url
http://127.0.0.1:8000/categoryupdate/<str:pk>
Sample Input
Authorization : Token <token>
{
    "title":"Updated Sample",
    "created_by": 4
}
Sample Output
{
    "message": "Title updated successfully",
    "data": {
        "id": 2,
        "title": "Updated Sample",
        "time": "2024-03-06T11:48:31.761510Z",
        "created_date": "2024-03-06T11:48:31.761510Z",
        "created_by": 4
    }
}

5. To Delete

url
 http://127.0.0.1:8000/categorydelete/<str:pk>/
Sample Input
Authorization : Token <token>
Sample Output
{
    "message": "success,Category deleted"
}

Task

1. To list

url
http://127.0.0.1:8000/tasklist/
Sample Input
Authorization : Token <token>
Sample Output
[
    {
        "id": 1,
        "title": "Rest api",
        "description": "description of the project",
        "created": "2024-03-07T06:49:27.426133Z",
        "started": null,
        "ended": null,
        "status": false,
        "created_date": "2024-03-07T06:49:27.426133Z",
        "category": null,
        "created_by": 4
    }
]

To Create

url
http://127.0.0.1:8000/taskcreate/
Sample Input
Authorization : Token <token>
{
    "title": "Project2",
    "category_id": 2,
    "description": "description of the project.",
    "status": false
}
Sample Output
{
    "id": 10,
    "title": "Project2",
    "description": "description of the project.",
    "created": "2024-03-11T05:25:07.158581Z",
    "started": null,
    "ended": null,
    "status": false,
    "created_date": "2024-03-11T05:25:07.158581Z",
    "category": null,
    "created_by": 4
}

To Update

url
http://127.0.0.1:8000/taskupdate/<str:pk>/
Sample Input
Authorization : Token <token>
{
    "title":"Updated project 2",
    "description": "description of the project",
    "created_by": 4
}
Sample Output
{
    "message": "Task updated successfully",
    "data": {
        "id": 11,
        "title": "Updated project 2",
        "description": "description of the project",
        "created": "2024-03-11T05:30:17.092751Z",
        "started": null,
        "ended": null,
        "status": false,
        "created_date": "2024-03-11T05:30:17.092751Z",
        "category": null,
        "created_by": 4
    }
}

To Delete

url
http://127.0.0.1:8000/taskdelete/3/
Sample Input
Authorization : Token <token>
Sample Output
{
    "message": "success,User deleted"
}

How to create an API

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages