Skip to content

F4R4N/todolist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

todolist django rest framework

a todolist api with django rest framework

Backend of: todo app

installation

  1. install python3 from here
  2. pip install -r requirements.txt
  3. python manage.py migrate
  4. python manage.py createsuperuser(insert user name and password)
  5. python manage.py runserver

api paths

api/v1/

api/v1/todo/

Allowed Methods : GET
Access Level : Authorized users
return array of objects of all todos in the database related to the authorized user.
you can get a specific todo object with passing the pk to the end of the path.

api/v1/todo/add/

allowed methods : POST
Access Level : Authorized users
fields : 'required': {'title'}, 'optional': {"description", "image", "is_active", "priority", "send_email"}
POST : The data should include fields available if user authorized.

api/v1/todo/edit/{key}/

allowed methods : PUT
Access Level : Authorized users
fields : 'required': 'optional': {"title", description", "image", "is_active", "priority", "send_email"}
POST : The data should include fields available if user authorized.

api/v1/todo/delete/{key}/

allowed methods : DELETE
Access Level : Authorized users
DELETE : there is no data to send. you should put the key of products that are in user cart you want to delete in the url instead of {key}

auth/v1/

auth/v1/login/

allowed methods : POST
Access Level : Public
fields : 'required': {'username', 'password'}
POST : the data you post should include 'username' and 'password' fields if the user was authorized the access token and the refresh token will return as json.more information about JWT

auth/v1/login/refresh/

allowed methods : POST
Access Level : Public
fields : 'required': {'refresh'}
POST : the data you post should include 'refresh' and the value of it should be user refresh token that is sent when user login.

auth/v1/register/

allowed methods : POST
Access Level : Public
fields : 'required': {'username', 'password1', 'password2', 'email', 'first_name', 'last_name'}
POST : should include the 'fields' keys and proper value. errors and exceptions handled , should have a proper place to show them in frontend.

auth/v1/change_password/{pk}/

allowed methods : PUT
Access Level : Authorized users
fields : 'required': {'old_password', 'password1', 'password2'}
PUT : should include 'fields' keys with proper values. errors and exceptions handled , should have a proper place to show them in frontend.

auth/v1/update_profile/{pk}/

allowed methods : PUT
Access Level : Authorized users
fields : 'optional': {'username', 'first_name', 'last_name', 'email'}
PUT : should include the authorized user access token. the uniqueness of email and username handled.

auth/v1/logout/

allowed methods : POST
Access Level : Authorized users
fields : 'required': {'refresh_token'}
POST : should include the authorized user access token. post user refresh token with 'refresh_token' key to expire the access and refresh token of the given user.

auth/v1/change_image/{pk}/

allowed methods : PUT
Access Level : Authorized users
fields : 'required': {'image'}
PUT : should include the authorized user access token