Git Product home page Git Product logo

datagrokrassignment's Introduction

DataGroKrAssignment

Rest API for Northwind database

Section 1

1.DDL_Statements.sql
File contains the DDL queries for creation of table in the northwind database.

2.Loading_data.sql
File contains script for loading data from .csv files.
Note: Please change the .csv file locations according to your local environment in this file.

Section 2

Section2_Queries.sql
This contains below five queries:

  1. List all the products with cost above the average price of the products.
  2. Give the identifier, name, and total sales of employees, ordered by the employee identifier for employees who have sold more than 70 different products.
  3. Identify the customers who have active orders.
  4. Find the customer with maximum number of orders.
  5. List all the employees who have sold at least one of the products ‘Gravad Lax’ or ‘Mishi Kobe Niku’.

Section 3

Environment Setup

  1. Install Spring Tool Suite 4 using the link Download
  2. Download the Source code from the repository.
  3. Using STS4 import the code using maven and specify the pom.xml file.
  4. It will download all the dependencies required for the API.
  5. Open application.properties and change the MySql Database Credentials(Username and Password).
  6. Run as SpringBoot App.
  7. API should run.

API Specification

BASE_URL = http://localhost:8080/api/v1

  1. Insert, update and select on customers
    Insert : BASE_URL+/customers
    POST Request
    It should be accompanied with a JSON object in the body, similar to customer object structure.
    For eg. { "customerId": "MIMEA", "companyName": "Milind Jain and Mehul Associates", "contactName": "Milind Jain", "contactTitle": "Co-Owner", "address": "71/48 Near K.V. No 5 Madhyam Marg Mansarovar", "city": "Jaipur", "region": "Rajasthan", "postalCode": "302020", "country": "India", "phone": "91-8947082516", "fax": "91-8947082516" }

Update : BASE_URL+/customers
POST Request
It should be accompanied with a JSON object in the body, similar to customer object structure. For Eg. - Similar to the structure in insert mentioned above with updated values.

Select All Customers : BASE_URL+/customers
GET Request
Nothing to be given in BODY of Request.

Select Customer By ID : BASE_URL+/customers/{customerId}
GET Request
For eg. http://localhost:8080/api/v1/customers/MIMEA

  1. Insert, update and select on products
    Insert : BASE_URL+/products
    POST Request
    It should be accompanied with a JSON object in the body, similar to products object structure.
    For eg. { "productId": 1, "productName": "Chai", "supplier": { "supplierId": 2, "companyName": "New Orleans Cajun Delights", "contactName": "Shelley Burke", "contactTitle": "Order Administrator", "address": "P.O. Box 78934", "city": "New Orleans", "region": "LA", "postalCode": "70117", "country": "USA", "phone": "(100) 555-4822", "fax": null, "homePage": "#CAJUN.HTM#\r" }, "category": { "categoryId": 1, "categoryName": "Beverages", "description": "Soft drinks coffee teas beers and ales\r" }, "quantityPerUnit": "10 boxes x 20 bags", "unitPrice": 18.0, "unitsInStock": 39, "unitsOnOrder": 0, "reorderLevel": 10, "discontinued": 0 }

Update : BASE_URL+/products
POST Request
It should be accompanied with a JSON object in the body, similar to products object structure.
For Eg. - Similar to the structure in insert mentioned above with updated values.

Select All Products : BASE_URL+/products
GET Request
Nothing to be given in BODY of Request.

Select Product By ID : BASE_URL+/products/{productId}
GET Request
For eg. http://localhost:8080/api/v1/products/1

  1. Order history of given customer
    URL - BASE_URL+/customers/orders/{customerId}
    GET Request For eg. http://localhost:8080/api/v1/customers/orders/"MIMEA"

Note: You can also find the above specifications after deploying the rest api, just use the below links

For UI output http://localhost:8080/api/v1/swagger-ui/index.html

For JSON Docs ouput http://localhost:8080/api/v1/v2/api-docs

datagrokrassignment's People

Contributors

milindjain12 avatar

Watchers

James Cloos avatar  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.