Code Monkey home page Code Monkey logo

customer-api's Introduction

customer-api

An API in Java and Spring Framework for customer registration.

How should the API work?

The API must create, update, delete and list our customers. The API has the following endpoints:

POST / customers: register a customer.

** Body: **

{ "cpf": "cpf", "fullName": "John Peter", "customerAddress": { "id": 6, "street": "Street", "number": "Number", "city": "City", "state": "State", "zipCode": "zip code", "country": "Country" } }

Onde:

cpf: client id; fullName: full name of the customer. customerAddress: full address of the customer.

You must return with body with one of the following codes:

  • 201: if successful.

PUT / customers / {id}: updates a customer.

** Body: **

{ "cpf": "cpf", "fullName": "John Peter", "customerAddress": { "id": 6, "street": "Street", "number": "Number", "city": "City", "state": "State", "zipCode": "zip code", "country": "Country" } }

The object to be modified must be sent. Void return.

The response must contain the following codes:

  • 200: in case of success.

GET / customers: returns all customers.

A list of customers must be returned.

{ "cpf": "cpf", "fullName": "John Peter", "customerAddress": { "id": 6, "street": "Street", "number": "Number", "city": "City", "state": "State", "zipCode": "zip code", "country": "Country" } }, { "cpf": "cpf", "fullName": "John Peter", "customerAddress": { "id": 6, "street": "Street", "number": "Number", "city": "City", "state": "State", "zipCode": "zip code", "country": "Country" } }

The response must contain the following codes:

  • 200: if there are registered customers
  • 404: if there are no customers created.

DELETE / customers / {id}: remove a client by id.

The response must contain the following codes:

  • 204: in case of success.
  • 404: if you can't find the customer.

Tests

  • To execute the unit test, the command executed must be:

mvn test

Execution

By default, the API is available at [http: // localhost: 8080 /] (http: // localhost: 8080 /)

To run the API we can use the following methods:

java -jar customer-base-0.0.1-SNAPSHOT.war

or with the following command

mvn spring-boot: run

customer-api's People

Contributors

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