Code Monkey home page Code Monkey logo

address-book's Introduction

Address Book

Address Book Assignment developed with Java and Spring Boot

REST API Features

  • Address book will hold name and phone numbers of contact entries

  • REST API have endpoints for the following -

    • Users should be able to add new contact entries

    • Users should be able to remove existing contact entries

    • Users should be able to print all contacts in an address book

    • Users should be able to maintain multiple address books

    • Users should be able to print a unique set of all contacts across multiple address books

How to start up the REST API

Test

$ mvn test

Build

$ mvn install

Docker Build

$ docker build -t address-book/address-book-docker .

Docker Run

$ docker run -p 8080:8080 address-book/address-book-docker

API Endpoints

  1. Create new Address Book
POST http://localhost:8080/api/v1/address-books

 Payload:
 {
    "name": "finance contacts"
 }

 Response: 201 Created
 {
  "id": 762698279,
  "name": "finance contacts",
  "contacts": []
}
  1. Add Contact in Address Book
 POST http://localhost:8080/api/v1/address-books/{addressBookId}/contacts
 
 ex: POST http://localhost:8080/api/v1/address-books/762698279/contacts

 Payload: 
 {
    "firstName": "John",
    "lastName": "Moore",
    "phoneNumbers": [
       "12343356",
       "566554433"
      ]
  }
  
  Response: 201 Created
{
  "id": 767781373,
  "firstName": "John",
  "lastName": "Moore",
  "phoneNumbers": [
     "12343356",
     "566554433"
  ]
}
  1. Get Contact list in Address Book
GET http://localhost:8080/api/v1/address-books/{addressId}

ex: GET http://localhost:8080/api/v1/address-books/762698279

 Response: 200 OK
  {
      "id": 767781373,
      "firstName": "John",
      "lastName": "Moore",
      "phoneNumbers": [
          "12343356",
          "566554433"
      ]
  }
]
  1. Update Contact in Address Book
PUT http://localhost:8080/api/v1/address-books/{addressId}/contacts

ex: PUT http://localhost:8080/api/v1/address-books/762698279/contacts

Payload:
{
    "id": 767781373,
    "firstName": "Josh",
    "lastName": "Mayor",
    "phoneNumbers": [
       "12343356"
       ]
    }
Response: 200 OK
{
    "id": 767781373,
    "firstName": "Josh",
    "lastName": "Mayor",
    "phoneNumbers": [
        "12343356"
    ]
}
  1. Get list of all Address Books
GET http://localhost:8080/api/v1/address-books
  1. Get unique set of Contacts across all Address Books
GET http://localhost:8080/api/v1/address-books/unique-contacts
  1. Delete contact in Address Book
DELETE http://localhost:8080/api/v1/address-book/{addressId}/contact/{contactId}

ex: DELETE http://localhost:8080/api/v1/address-book/1383388594/contact/1964920837
  1. Delete Address Book
DELETE http://localhost:8080/api/v1/address-book/{addressId}/

ex: DELETE http://localhost:8080/api/v1/address-book/762698279/

API DOCS

 http://localhost:8080/swagger-ui.html

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.