Skip to content

Example of rest api developed in python with mongo db as backend

Notifications You must be signed in to change notification settings

sanketmehta28/rest_api_with_mongo_db

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rest_api_with_mongo_db

How to Run:

  • Install python 3.6 and create virtualenv
  • Install all dependency from requirements.txt file using pip3 install -r requirements.txt in that virtualenv
  • I have used a cloud instance of mongodb
  • credentials are stored in credentials.json file which is stored separately
  • put 'credentials.json' in heady_assignment dir first and runproject with below command:
    1. python manage.py runserver 0.0.0.0:80 It will start the server to accept api request

List of APIs:

  1. API to add category:
    • url: http://localhost/rest_api/category
    • payload: { "name": "sample_category", "parent": null } OR
    • payload: { "name": "child_category", "parent": "sample_category" }
    • send a POST request on thi url with this payload (as example)
  2. API to add product mapped to a category or categories
    • url: http://localhost/rest_api/product
    • payload: { "name": "sample_product", "price": 15, "currency": "USD", "category_list": ["sample_category"] }
    • send a POST request on this url with this payload (as example) where category is provided in category_list field of payload
  3. API to get all the categories with child category
  4. API to get all products by category
  5. API to update product details

About

Example of rest api developed in python with mongo db as backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages