An old Assignment
APIs implemented
- Create Site
- Add Connection
- Get Site
- Get All Sites
- Update Site name
REST API Details
- Create Site
POST http://localhost:8080/sitetracker/rest/site/
Request
{
"siteName" : "SiteA",
"connections": [
{
"siteName": "Augsburg",
"distance": 10
},
{
"siteName": "Augsburg",
"distance": 15
}
]
}
Response
{
"siteId": "33",
"siteName": "SiteA",
"connections": [
{
"id": "3",
"siteName": "Augsburg",
"distance": 10
},
{
"id": "4",
"siteName": "Augsburg",
"distance": 15
}
]
}
-
Get Site Details
GET http://localhost:8080/sitetracker/rest/site/{siteId} Response
{
"siteName": "SiteA",
"connections": [
{
"siteName": "Augsburg",
"distance": 10
},
{
"siteName": "Augsburg",
"distance": 15
}
]
}
-
Update Site Name
PUT http://localhost:8080/sitetracker/rest/site/{siteId} Request
{
"siteName": "Edina"
}
- Add Connection to Site
PUT http://localhost:8080/sitetracker/rest/site/{siteId}/connection
Request
{
"siteName": "SiteB",
"distance": 4
}
- Get All Sites
GET http://localhost:8080/sitetracker/rest/site/
Response
[
{
"siteId":null,
"siteName":"Akola"
},
{
"siteId":null,
"siteName":"Allegheny"
}
]
Things to be implemented
- Caching. Hibernate Second level cache is not implemented yet
- Optimistic lock at Object level to avoid concurrency issues.
- More unit and integration test cases
- More Logging.
- Spring AOP for Application Logging
- More data validations
Schema Creation Use the below attached SQL file to create the schema. This is for MySql.