API for the Member Service
src/main/java/com/empowerhack/family/memberservice
/data
Sample.java
- Dummy data during In-memory usage
/entity
- Domain Model/filter
- Runs on every Request and injects Application Version (from/resources/application.yml
Config) into Response Header/repository
- Manage the Domain Model
src/main/resources
application.yml
- Application config (containsdev
&prod
Using HAL, so resources and functionality should be auto discoverable.
Send Content-type: application/json
Always contains version X-Application-Version: vX.Y.Z
(eg. v1.2.3)
Response
{
"_links": {
"members": {
"href": "http://localhost:8081/members{?page,size,sort}",
"templated": true
},
"profile": {
"href": "http://localhost:8081/profile"
}
}
}
Response
{
"_embedded": {
"members": [
{
"name": "Member 1",
"email": "[email protected]",
"isPrivate": true,
"availability": 50,
"urls": {
"LinkedIn": "http://linkedin.com/member1",
"Twitter": "http://twitter.com/member1",
"Facebook": "http://facebook.com/member1"
},
"skills": [
"Java",
"PHP",
"DevOPs"
],
"interests": [
"Learning",
"Networking"
],
"_links": {
"self": {
"href": "http://localhost:8081/members/1"
},
"member": {
"href": "http://localhost:8081/members/1"
}
}
},
{
"name": "Member 2",
"email": "[email protected]",
"isPrivate": false,
"availability": 90,
"urls": {
"LinkedIn": "http://linkedin.com/member2",
"Twitter": "http://twitter.com/member2",
"Facebook": "http://facebook.com/member2"
},
"skills": [
"JS",
"Ruby",
"UI"
],
"interests": [
"New Technology",
"Charity",
"NGO"
],
"_links": {
"self": {
"href": "http://localhost:8081/members/2"
},
"member": {
"href": "http://localhost:8081/members/2"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8081/members"
},
"profile": {
"href": "http://localhost:8081/profile/members"
},
"search": {
"href": "http://localhost:8081/members/search"
}
},
"page": {
"size": 20,
"totalElements": 2,
"totalPages": 1,
"number": 0
}
}
{
"name": "test name",
"email": "[email protected]"
}
Response
{
"name": "test name",
"email": "[email protected]",
"isPrivate": true,
"_links": {
"self": {
"href": "http://localhost:8081/members/1"
},
"member": {
"href": "http://localhost:8081/members/1"
}
}
}
Response
{
"name": "Member 1",
"email": "[email protected]",
"isPrivate": true,
"availability": 50,
"urls": {
"LinkedIn": "http://linkedin.com/member1",
"Twitter": "http://twitter.com/member1",
"Facebook": "http://facebook.com/member1"
},
"skills": [
"Java",
"PHP",
"DevOPs"
],
"interests": [
"Learning",
"Networking"
],
"_links": {
"self": {
"href": "http://localhost:8081/members/1"
},
"member": {
"href": "http://localhost:8081/members/1"
}
}
}
Response
{
"_embedded": {
"members": [
{
"name": "Member 1",
"email": "[email protected]",
"isPrivate": true,
"availability": 50,
"urls": {
"LinkedIn": "http://linkedin.com/member1",
"Twitter": "http://twitter.com/member1",
"Facebook": "http://facebook.com/member1"
},
"skills": [
"Java",
"PHP",
"DevOPs"
],
"interests": [
"Learning",
"Networking"
],
"_links": {
"self": {
"href": "http://localhost:8081/members/1"
},
"member": {
"href": "http://localhost:8081/members/1"
}
}
},
{
"name": "Member 2",
"email": "[email protected]",
"isPrivate": false,
"availability": 90,
"urls": {
"LinkedIn": "http://linkedin.com/member2",
"Twitter": "http://twitter.com/member2",
"Facebook": "http://facebook.com/member2"
},
"skills": [
"JS",
"Ruby",
"UI"
],
"interests": [
"New Technology",
"Charity",
"NGO"
],
"_links": {
"self": {
"href": "http://localhost:8081/members/2"
},
"member": {
"href": "http://localhost:8081/members/2"
}
}
}
]
},
"_links": {
"self": {
"href": "http://localhost:8081/members/search/findByName?name=Member"
}
}
}
- Java v8+
- Maven
mvn spring-boot:run
OR
mvn package
java -jar target/family-memberservice-0.0.1-SNAPSHOT.jar
After following either step, the Webserver will be running on http://localhost:8081