Coder Social home page Coder Social logo

myretail's Introduction

myretail

Overview

myretail is a RESTful CRUD api designed to maintain product information.

Spring Boot and Maven are used to create and build the controller services and cassandra is used to persist the data.

For quickly up and running with this application, perform the below two steps.

  1. Run the database script( database.cql ) from repository in cassandra database instance and for customized database port mappings update cassandra.properties inside source appropriately.

  2. mvn clean install and mvn spring-boot:run

Service API

HTTP GET

Request

URL: http://hostname:port/v1/products/{id} Method: GET Content-Type: application/json

Response Success Status: 200 Content-Type: application/json { "id": 13860428, "name": "The Big Lebowski [Blu-ray]", "current_price": { "value": 26.37, "currency_code": "USD" } }

HTTP GET

Request

URL: http://hostname:port/v1/products Method: GET Content-Type: application/json

Response Success Status: 200 Content-Type: application/json [ { "id": 13860433, "name": "The Big Lebowski [Blu-ray]", "current_price": { "value": 26.37, "currency_code": "USD" } }, { "id": 13860435, "name": "The Big Lebowski [Blu-ray]", "current_price": { "value": 26.37, "currency_code": "USD" } } ]

URL: http://hostname:port/v1/products/{invalid-id} Method: GET Content-Type: application/json

Not Found

Status: 404 Content-Type: application/json

{ "message": "Invalid Product Id", "errorCode": "Known Error" }

HTTP POST

Request

URL: http://hostname:port/v1/products Method: POST Content-Type: application/json Body: { "name": "The Big Lebowski [Blu-rayuu]", "current_price": { "value": 26.37, "currency_code": "USD" } } Response

Success

Status: 201 Content-Type: application/json { "id": 13860428, "name": "The Big Lebowski [Blu-rayuu]", "current_price": { "value": 26.37, "currency_code": "USD" } }

HTTP PUT

Request

URL: http://hostname:port/v1/products/{id} Method: PUT Body:

{ "name": "The Big Lebowski [Blu-rayuu]", "current_price": { "value": 26.37, "currency_code": "USD" } } Response

Success

Status: 200 Content-Type: application/json

{ "id": 13860428, "name": "The Big Lebowski [Blu-rayuu]", "current_price": { "value": 26.37, "currency_code": "USD" } }

HTTP DELETE

Request

URL: http://hostname:port/v1/products/{id} Method: DELETE Body: { } Response

Success

Status: 200 Content-Type: application/json

Product 13860442 deleted

Integration Testing

REST Assured is used to implement integration tests

Execution

Run integration test (myretail service api is required to be up and running): $ mvn test -Dtest=myretail

myretail's People

Contributors

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