Git Product home page Git Product logo

shop-api's Introduction

shop django rest framework

a shop api with django rest framework

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/product/

Allowed Methods : GET
Access Level : Public
return array of objects of all products in the database that tagged as available. and also have a nested inner object of category that related to it as ForignKey relation.
you can get a specific product object with passing the pk to the end of the path.

api/v1/product/?search={query}

Allowed Methods : GET
Access Level : Public
search in products by given keywords
search by "search" keyword

api/v1/category/

allowed methods : GET
Access Level : Public
return objects of categories that admin made.
you can get a specific category object with passing the pk to the end of the path.

api/v1/category/?search={query}

Allowed Methods : GET
Access Level : Public
search in categories by given keywords
search by "search" keyword

api/v1/user/

allowed methods : GET
Access Level : Admin
return object of all registered users
you can get specific user object with passing the pk to the end of the path.

api/v1/cart/

allowed methods : GET
Access Level : Authorized users
GET : return all products in the authenticated user cart

api/v1/cart/?search={query}

Allowed Methods : GET
Access Level : Authorized users
search in user cartitem by given keywords
search by "search" keyword

api/v1/cart/add/

allowed methods : POST
Access Level : Authorized users
fields : 'required': {'quantity', 'product_id'}
POST : The data should include fields available if user authorized.

api/v1/cart/delete/{pk}/

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

api/v1/cart/add_one/{pk}/

allowed methods : GET
Access Level : Authorized users
GET : there is no data to send. you should put the pk of products that are in user cart you want to add one to it in the url instead of {pk}

api/v1/cart/reduce_one/{pk}/

allowed methods : GET
Access Level : Authorized users
GET : there is no data to send. you should put the pk of products that are in user cart you want to reduce one from it in the url instead of {pk}

auth/

auth/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/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/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/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/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/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/change_image/{pk}/

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

auth/delete_profile/{pk}/

allowed methods : DELETE
Access Level : Authorized users
fields : 'required': {'password'}
DELETE : should pass the pk to the end of the url. and also user password to authorize the user .


To-Do:

  • add users and configurations
  • add CORS and configurations
  • Make the cart
  • Add JWT authentication system
  • add cors and configurations
  • check for availability on get method for all products
  • Add JWT authentication system
  • add product api
  • add delete feature for cart
  • add documentation
  • add CSRF and configurations
  • add the math operations for quantity
  • Make the cart
  • calculate the quantity and valid products to buy
  • add search option for product and category
  • third party register
  • add support
  • add billing part
  • add educational blog
  • beautify the code
  • add the frontend

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.