This is a spring boot REST API that will enable a client to perform CRUD operations on the contact collection.
# To build the project standard maven build is sufficient
mvn clean install
# To start/run the project spring boot maven plugin is included just run
mvn spring-boot:run
# The integration test may be executed using
mvn test
Once the application is started,
- Goto http://localhost:8080/contact/ which return all contacts available.
[
{
"id": 1,
"name": {
"firstName": "Sai Eshwar",
"middleName": "Reddy",
"lastName": "Bobbili"
},
"address": {
"street": "Barton",
"city": "Charlotte",
"state": "NC",
"zip": "28262"
},
"phones": [
{
"number": "12345",
"type": "personal"
}
],
"email": "[email protected]"
}
]
-
Goto http://localhost:8080/contact/{id} which return all the information about the contact.
Goto: http://localhost:8080/contact/1 you will get contact with id =1 as below
[ { "id": 1, "name": { "firstName": "Sai Eshwar", "middleName": "Reddy", "lastName": "Bobbili" }, "address": { "street": "Barton", "city": "Charlotte", "state": "NC", "zip": "28262" }, "phones": [ { "number": "12345", "type": "personal" } ], "email": "[email protected]" } ]
- Execute the following in cURL
##For update replace POST to PUT
$ curl -i -X POST -H "Content-Type:application/json" -d "{
"name": {
"firstName": "Akhil",
"middleName": "Shetty",
"lastName": "Madhamshetty"
},
"address": {
"street": "Barton",
"city": "Charlotte",
"state": "NC",
"zip": "28262"
},
"phones": [
{
"number": "12345",
"type": "personal"
}
],
"email": "[email protected]"
}"