Imagine a store with many different products...These products have specific characteristics...
- Database: store
- Collections: products
- url: localhost
- port: 12345
Obs.: I used RoboMongo client to access data in MongoDB.
mvn package spring-boot:run
{
"_links" : {
"products" : {
"href" : "http://localhost:8080/api/products{?page,size,sort}",
"templated" : true
},
"profile" : {
"href" : "http://localhost:8080/api/alps"
}
}
}
{
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products{?page,size,sort}",
"templated" : true
},
"next" : {
"href" : "http://localhost:8080/api/products?page=1&size=5{&sort}",
"templated" : true
}
},
"_embedded" : {
"pendrives" : [ {
"id" : 4,
"name" : "Data Traveler ",
"company" : "Kingston",
"type" : "PENDRIVE",
"gigabytes" : 16,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products/4"
}
}
}, {
"id" : 5,
"name" : "Cruzer Fit",
"company" : "Sandisk",
"type" : "PENDRIVE",
"gigabytes" : 32,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products/5"
}
}
} ],
"notebooks" : [ {
"id" : 1,
"name" : "MacBook Pro",
"company" : "Apple",
"type" : "NOTEBOOK",
"screenSize" : 15,
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products/1"
}
}
} ],
"smartPhones" : [ {
"id" : 2,
"name" : "Moto X",
"company" : "Motorola",
"type" : "SMARTPHONE",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products/2"
}
}
}, {
"id" : 3,
"name" : "Iphone 6 Plus",
"company" : "Apple",
"type" : "SMARTPHONE",
"_links" : {
"self" : {
"href" : "http://localhost:8080/api/products/3"
}
}
} ]
},
"page" : {
"size" : 5,
"totalElements" : 6,
"totalPages" : 2,
"number" : 0
}
}