Coder Social home page Coder Social logo

product-api-demo's Introduction

Product API Demo

Added APIs as mention below. Added API Test for the same.

Sample product data

{"product_id":"<fill>","sellerId":"<fill>","title":"<fill>","manufacturer":"<fill>","price":{"range":"<fill>","min":<fill>,"max":<fill>},"isLowQuantity":false,"isSoldOut":false,"isBackorder":false,"metafields":[{"key":"Capacity","value":"<fill>"},{"key":"<fill>","value":"<fill>"}],"requiresShipping":true,"isVisible":true,"publishedAt":{"$date":"2020-02-12T08:05:39.743Z"},"createdAt":{"$date":"2010-08-23T05:53:16.134Z"},"updatedAt":{"$date":"2019-08-23T05:53:16.134Z"},"workflow":{"status":"new"}}
{"product_id":"121234353567786","sellerId":"87866","title":"Voltas 1.5 Ton Adjustable Inverter 5 Star Copper (2019 Range) 185V ADS (R32) Split AC (White)","pageTitle":"Voltas 1.5 Ton Adjustable Inverter.","description":"Stay at ease even when the mercury hits the roof by opting for this Voltas Inverter Adjustable Split AC. It has a capacity of 1.5 tons, hence it can cover a large area, while the 5-star energy rating helps you to reduce electricity costs significantly. It ensures stabilizer free operation so that it stays protected against voltage fluctuations. The 100 percent copper make ensures optimum performance as well as energy efficiency. (Star rating of model is as per 2018/2019 BEE rating, manufacturing can be of 2019 or before)","manufacturer":"Voltas","price":{"range":"24999","min":24999,"max":24999},"isLowQuantity":false,"isSoldOut":false,"isBackorder":false,"metafields":[{"key":"Capacity","value":"1.5 ton"},{"key":"Rating","value":"Inverter 5 Star"}],"requiresShipping":true,"isVisible":true,"publishedAt":{"$date":"2020-02-12T08:05:39.743Z"},"createdAt":{"$date":"2010-08-23T05:53:16.134Z"},"updatedAt":{"$date":"2019-08-23T05:53:16.134Z"},"workflow":{"status":"new"}}

REST APIs

Create REST API which has

  • POST endpoint to create products POST /product/
{
    "product_id":"1",
    "sellerId":"[email protected]",
    "title":"Book 1",
    "manufacturer":"Personal",
    "metaFields":
    [
        {
        "key": "1",
        "value": "1"
        },
        {
        "key": "2",
        "value": "2"
        }
    ],
    "requiresShipping": true,
    "isVisible": true,
    "workFlow": {
        "status": "new"
    }
}
  • GET endpoint to fetch product details GET /product/prodcutID

  • PUT end point to update product details PUT /product/prodcutID

{
    "sellerId": "[email protected]",
    "title": "Book 1",
    "manufacturer": "Personal",
    "price": {
        "min": 100,
        "max": 100,
        "range": 100
    },
    "metaFields": [
        {
            "key": "1",
            "value": "2"
        },
        {
            "key": "2",
            "value": "3"
        }
    ],
    "requiresShipping": true,
    "publishedAt": {
        "$date": "2021-04-16T11:18:59.737Z"
    },
    "createdAt": {
        "$date": "2021-04-16T11:18:59.737Z"
    },
    "updatedAt": null,
    "workFlow": {
        "status": "new"
    },
    "visible": true,
    "lowQuantity": false,
    "soldOut": false,
    "backorder": false
}
  • DELETE end point to delete product details DELETE /product/prodcutID

All above APIs should do basic validation and return appropriate responses code with the responses

Create another REST API which has

  • POST endpoint to create products price (one product at a time) POST /product/price
{
	"product_id":"1",
	"price":{
		"range":"4.00-5.00",
		"min":4.0,
		"max":5.0
	}
}
  • GET endpoint to fetch product price (for a product) GET /product/price/productId

Sample data

  • Product data {"product_id":"","sellerId":"","title":"","manufacturer":"","isLowQuantity":false,"isSoldOut":false,"isBackorder":false,"metafields":[{"key":"Capacity","value":""},{"key":"","value":""}],"requiresShipping":true,"isVisible":true,"publishedAt":{"$date":"2020-02-12T08:05:39.743Z"},"createdAt":{"$date":"2010-08-23T05:53:16.134Z"},"updatedAt":{"$date":"2019-08-23T05:53:16.134Z"},"workflow":{"status":"new"}}

  • Price data {"product_id":"1212323","price":{"range":"4.00-5.00","min":4.50,"max":5.00}}

product-api-demo's People

Contributors

naman223 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.