This is a spring boot application for a personalized data REST API service that provides shoppers personalized information to eCommerce servers.
The service consists of 2 main parts:
- Interface with data team (internal) - Receiving shoppers’ personalized information and product metadata from our data team and storing it in a specified database.
- Interface with eCommerce (external) - Provide fast-reading operation for the shoppers’ personalized information.
-
Build: Gradle
-
- Spring JPA | Spring Security | Lombok
-
Java Version (Java 17)
- ADD product metadata
- ADD shoppers’ personalized information
- GET personalized information by shopper
- Filter by Category & Brand
- Limit (default - 10, max - 100)
This assumes that you already have:
- Gradle installed
- Java 17 installed and configured as the current Java version for the environment.
Verify that
java -version
outputs version 17 and ensure that theJAVA_HOME
environment variable is set to the Java installation directory containingbin
. - Redis installed and running
git clone https://github.com/thilina999/personalized-data-core.git
Open the project in IntelliJ(or any other IDEA), which will automatically build it
Open application.properties
file. Update valid database connection details and make sure spring.jpa.hibernate.ddl-auto
is set to create
when running the application for the first time.
Run the PersonalizedDataCoreApp
class to run the application. This will start the application and create the required entities in the database.
POST
- http://localhost:8080/internal/api/v1/product-metadata
Request body
{
"productId": "BB-2144746855",
"category": "Babies",
"brand": "Babyom"
}
POST
- http://localhost:8080/internal/api/v1/shopper-products
Request body
{
"shopperId": "S-1000",
"shelf": [
{
"productId": "BB-2144746855",
"relevancyScore": 55.16626010671777
}
]
}
GET
- http://localhost:8080/external/api/v1/products?shopperId=S-1000
GET
- http://localhost:8080/external/api/v1/products?shopperId=S-1000&category=Books&brand=BrandH&limit=30
Request Header
Authorization: Basic (Username: actuator, Password: !data2024)
Response Body
[
{
"productId": "BB-2144746855",
"category": "Babies",
"brand": "Babyom"
},
...
]