Giter Club home page Giter Club logo

dokan's Introduction

Dokan - E-Commerce API

"Dokan" is a robust e-commerce platform designed to empower merchants and entrepreneurs with seamless online selling capabilities. It offers a user-friendly interface for setting up and managing digital storefronts, enabling businesses to showcase their products effectively. Dokan supports various features like customizable storefronts, multi-vendor functionality, secure payment gateways, and extensive product management tools. It fosters a vibrant marketplace where sellers can reach a wide audience, while buyers enjoy a rich shopping experience with diverse product offerings. With its scalable architecture and intuitive design, Dokan facilitates the growth and success of e-commerce ventures across different industries.

Product Management

1. Create a New Product

  • Endpoint: /api/products

  • Method: POST

  • Sample Request Body:

    {
        "name": "iPhone 13",
        "description": "A sleek and powerful smartphone with cutting-edge features.",
        "price": 999,
        "category": "Electronics",
        "tags": ["smartphone", "Apple", "iOS"],
        "variants": [
            {
                "type": "Color",
                "value": "Midnight Blue"
            },
            {
                "type": "Storage Capacity",
                "value": "256GB"
            }
        ],
        "inventory": {
            "quantity": 50,
            "inStock": true
        }
    }
  • Sample Response:

    {
        "success": true,
        "message": "Product created successfully!",
        "data": {
            "name": "iPhone 13",
            "description": "A sleek and powerful smartphone with cutting-edge features.",
            "price": 999,
            "category": "Electronics",
            "tags": ["smartphone", "Apple", "iOS"],
            "variants": [
                {
                    "type": "Color",
                    "value": "Midnight Blue"
                },
                {
                    "type": "Storage Capacity",
                    "value": "256GB"
                }
            ],
            "inventory": {
                "quantity": 50,
                "inStock": true
            }
        }
    }

2. Retrieve a List of All Products

  • Endpoint: /api/products

  • Method: GET

  • Sample Response:

    {
        "success": true,
        "message": "Products fetched successfully!",
        "data": [
            {
                "name": "iPhone 13",
                "description": "A sleek and powerful smartphone with cutting-edge features.",
                "price": 999,
                "category": "Electronics",
                "tags": ["smartphone", "Apple", "iOS"],
                "variants": [
                    {
                        "type": "Color",
                        "value": "Midnight Blue"
                    },
                    {
                        "type": "Storage Capacity",
                        "value": "256GB"
                    }
                ],
                "inventory": {
                    "quantity": 50,
                    "inStock": true
                }
            },
            {
                "name": "Samsung Galaxy S21",
                "description": "High-performance Android smartphone with advanced camera capabilities.",
                "price": 799,
                "category": "Electronics",
                "tags": ["smartphone", "Samsung", "Android"],
                "variants": [
                    {
                        "type": "Color",
                        "value": "Phantom Black"
                    },
                    {
                        "type": "Storage Capacity",
                        "value": "128GB"
                    }
                ],
                "inventory": {
                    "quantity": 30,
                    "inStock": true
                }
            }
            
        ]
    }

3. Retrieve a Specific Product by ID

  • Endpoint: /api/products/:productId

  • Method: GET

  • Sample Response:

    {
        "success": true,
        "message": "Product fetched successfully!",
        "data": {
            "name": "iPhone 13",
            "description": "A sleek and powerful smartphone with cutting-edge features.",
            "price": 999,
            "category": "Electronics",
            "tags": ["smartphone", "Apple", "iOS"],
            "variants": [
                {
                    "type": "Color",
                    "value": "Midnight Blue"
                },
                {
                    "type": "Storage Capacity",
                    "value": "256GB"
                }
            ],
            "inventory": {
                "quantity": 50,
                "inStock": true
            }
        }
    }

4. Update Product Information

  • Endpoint: /api/products/:productId

  • Method: PUT

  • Sample Request Body:

    {
        "name": "iPhone 13",
        "description": "A sleek and powerful smartphone with cutting-edge features.",
        "price": 999,
        "category": "Electronics",
        "tags": ["smartphone", "Apple", "iOS"],
        "variants": [
            {
                "type": "Color",
                "value": "Midnight Blue"
            },
            {
                "type": "Storage Capacity",
                "value": "256GB"
            }
        ],
        "inventory": {
            "quantity": 50,
            "inStock": true
        }
    }
  • Sample Response:

    {
        "success": true,
        "message": "Product updated successfully!",
        "data": {
            "name": "iPhone 13",
            "description": "A sleek and powerful smartphone with cutting-edge features.",
            "price": 999,
            "category": "Electronics",
            "tags": ["smartphone", "Apple", "iOS"],
            "variants": [
                {
                    "type": "Color",
                    "value": "Midnight Blue"
                },
                {
                    "type": "Storage Capacity",
                    "value": "256GB"
                }
            ],
            "inventory": {
                "quantity": 49,
                "inStock": true
            }
        }
    }

5. Delete a Product

  • Endpoint: /api/products/:productId

  • Method: DELETE

  • Sample Response:

    {
        "success": true,
        "message": "Product deleted successfully!",
        "data": null
     }
     

6. Search a product

  • Endpoint: /api/products?searchTerm=iphone
  • Method: GET
  • Sample Response:
{
    "success": true,
    "message": "Products matching search term 'iphone' fetched successfully!",
    "data": [
        {
            "name": "iPhone 13 Pro",
            "description": "The latest flagship iPhone model with advanced camera features.",
            "price": 999,
            "category": "Smartphones",
            "tags": ["iPhone", "Apple", "Mobile"],
            "variants": [
                {
                    "type": "Color",
                    "value": "Graphite"
                },
                {
                    "type": "Storage",
                    "value": "256GB"
                }
            ],
            "inventory": {
                "quantity": 50,
                "inStock": true
            }
        },
        {
            "name": "iPhone SE",
            "description": "Compact and affordable iPhone model with powerful performance.",
            "price": 399,
            "category": "Smartphones",
            "tags": ["iPhone", "Apple", "Mobile"],
            "variants": [
                {
                    "type": "Color",
                    "value": "White"
                },
                {
                    "type": "Storage",
                    "value": "128GB"
                }
            ],
            "inventory": {
                "quantity": 20,
                "inStock": true
            }
        }
    ]
}

Order Management

Order Management API Endpoints

1.Create a New Order

  • Endpoint: /api/orders

  • Method: POST

  • Request Body:

    {
        "email": "[email protected]",
        "productId": "5fd67e890b60c903cd8544a3",
        "price": 999,
        "quantity": 1
    }
  • Response:

    {
        "success": true,
        "message": "Order created successfully!",
        "data": {
            "email": "[email protected]",
            "productId": "5fd67e890b60c903cd8544a3",
            "price": 999,
            "quantity": 1
        }
    }
    

2.Retrieve All Orders

  • Endpoint: /api/orders

  • Method: GET

  • Sample Response:

    {
        "success": true,
        "message": "Orders fetched successfully!",
        "data": [
            {
                "email": "[email protected]",
                "productId": "5fd67e890b60c903cd8544a3",
                "price": 999,
                "quantity": 1
            }
        ]
    }

3. Retrieve Orders by User Email

  • Endpoint: /api/[email protected]

  • Method: GET

  • Sample Response:

    {
        "success": true,
        "message": "Orders fetched successfully for user email!",
        "data": [
            {
                "email": "[email protected]",
                "productId": "5fd67e890b60c903cd8544a3",
                "price": 999,
                "quantity": 1
            }
        ]
    }

Error Handling:

Sample Error Responses

  • Insufficient Quantity Error
{
    "success": false,
    "message": "Insufficient quantity available in inventory"
}
  • Not Found Error
{
 "success": false,
 "message": "Order not found"
}
  • Not Found Route
{
 "success": false,
 "message": "Route not found"
}

Application Routes:

Product

  • /api/v1/product (POST)
  • /api/v1/product (Get All Products)
  • /api/v1/product?searchTerm=Iphone (Get Search Products)
  • api/v1/product/66862f1ef362f9c62432d131 (Single GET)
  • api/v1/product/66862f1ef362f9c62432d131 (PUT)
  • api/v1/product/66862f1ef362f9c62432d131 (DELETE)

Product

Submission Format for Our Submission Box: (Please use the following format for your submissions:)

dokan's People

Contributors

shuvoprogram avatar

Stargazers

Pradeep Pawar avatar

Watchers

 avatar

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.