GithubHelp home page GithubHelp logo

qp-assessment's Introduction

Grocery Application

Overview

The Grocery Application is a RESTful API designed to manage grocery items. It provides endpoints for administrators to add, view, update, and delete products, as well as manage inventory levels.

API Endpoints

Add Product

Adds a new product to the system.

  • Method: POST
  • URL: /api/v1/admin/products
  • Request Body:
    {
      "name": "Samsung phone",
      "price": 50000,
      "quantity": 50
    }

Get All Products

Retrieves a list of all available products.

  • Method: GET
  • URL: /api/v1/admin/products

Get Single Product

Retrieves information about a specific product by ID.

  • Method: GET
  • URL: /api/v1/admin/products/{productId}
  • Example: /api/v1/admin/products/5

Update Single Product

Updates details (name, price, quantity) of a specific product.

  • Method: PUT
  • URL: /api/v1/admin/products/{productId}
  • Request Body:
    {
      "name": "Apple phone",
      "price": 101000,
      "quantity": 2
    }
  • Example: /api/v1/admin/products/2

Delete Single Product

Removes a product from the system by ID.

  • Method: DELETE
  • URL: /api/v1/admin/products/{productId}
  • Example: /api/v1/admin/products/4

Manage Inventory

Updates the inventory level of a specific product.

  • Method: PUT
  • URL: /api/v1/admin/products/{productId}/inventory
  • Request Body: The new quantity to add (integer).
    10
    
  • Example: /api/v1/admin/products/1/inventory

Usage

You can make HTTP requests to the provided endpoints using tools like curl or Postman. Here are some example HTTP requests:

Add Product

POST /api/v1/admin/products HTTP/1.1
Host: localhost:9999
Content-Type: application/json
Content-Length: 75

{
"name": "Samsung phone",
"price": 50000,
"quantity": 50
}

Get All Products

GET /api/v1/admin/products HTTP/1.1
Host: localhost:9999

Get Single Product

GET /api/v1/admin/products/5 HTTP/1.1
Host: localhost:9999

Update Single Product

PUT /api/v1/admin/products/2 HTTP/1.1
Host: localhost:9999
Content-Type: application/json
Content-Length: 68

{
"name": "Apple phone",
"price": 101000,
"quantity": 2
}

Delete Single Product

DELETE /api/v1/admin/products/4 HTTP/1.1
Host: localhost:9999

Manage Inventory

PUT /api/v1/admin/products/1/inventory HTTP/1.1
Host: localhost:9999
Content-Type: application/json
Content-Length: 2

10

qp-assessment's People

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.