Kaizen Profile API is a microservice for managing KaizenLAN user profiles and associated widget row information. This project's purpose is to provide a simple API to integrate with this data. The core application is developed in Java, utilizing the Spring Boot framework. The application uses Spring Data JPA to interact with a MySQL database.
This section assumes the user is familiar with installing Java 17 and running Maven-based Java applications. It also assumes knowledge of installing and configuring a MySQL database server.
Configure the setup_database.sql
file by including which database are using.
USE <replace_with_your_database_name>;
Then, run the script in a MySQL terminal.
Create the file in the directory ${user.home}/Documents/narlock/secrets/mysql.properties
if it does not exist, and include your MySQL credentials so that this API can read them from this properties file.
lmysql.username=<replace_with_your_mysql_username>
lmysql.password=<replace_with_your_mysql_password>
- Using Java 17: After building the application, navigate to the directory of the jar in a terminal and use
java -jar kaizen-profile-api.jar
to run the application. - Using Maven: In a terminal, use
mvn spring-boot:run
to run the application.
- Create a profile
- Update a profile
- Delete a profile
- Retrieve a profile
- Save row information
- Update row information
- Delete row information
Creates a Profile and Health entry for a Kaizen Profile.
POST /profile
Content-Type: application/json
{
"username": "narlock",
"birthDate": "2000-02-02",
"imageUrl": null,
"xp": 0,
"numRows": 1,
"pin": 1234,
"height": 723,
"weight": 175,
"goalWeight": 155,
"goalWater": 128
}
Response
HTTP/1.1 201 Created
{
"profile": {
"id": 12,
"username": "narlock",
"birthDate": "2000-02-02",
"imageUrl": null,
"xp": 0,
"numRows": 1,
"pin": "1234"
},
"health": {
"profileId": 12,
"height": 723.0,
"weight": 175.0,
"goalWeight": 155.0,
"goalWater": 128.0
},
"rowInfoList": null
}
Updates a Profile and Health entry for a Kaizen Profile.
PUT /profile
Content-Type: application/json
{
"profileId": 12,
"username": "narlock",
"birthDate": "2000-02-02",
"imageUrl": null,
"xp": 0,
"numRows": 1,
"pin": 1234,
"height": 723,
"weight": 175,
"goalWeight": 155,
"goalWater": 128
}
Response
HTTP/1.1 200 OK
{
"profile": {
"id": 12,
"username": "narlock",
"birthDate": "2000-02-02",
"imageUrl": null,
"xp": 0,
"numRows": 1,
"pin": "1234"
},
"health": {
"profileId": 12,
"height": 723.0,
"weight": 175.0,
"goalWeight": 155.0,
"goalWater": 128.0
},
"rowInfoList": null
}
Deletes an existing profile.
DELETE /profile/{id}
Response
HTTP/1.1 204 No Content
Retrieves a profile by its ID.
GET /profile/{id}
Content-Type: application/json
Response
HTTP/1.1 200 OK
{
"profile": {
"id": 12,
"username": "narlock",
"birthDate": "2000-02-02",
"imageUrl": null,
"xp": 0,
"numRows": 1,
"pin": "1234"
},
"health": {
"profileId": 12,
"height": 723.0,
"weight": 175.0,
"goalWeight": 155.0,
"goalWater": 128.0
},
"rowInfoList": []
}
Saves row information for a given profile ID.
POST /profile/{id}/rowInfo
Content-Type: application/json
{
"rowIndex": 1,
"widgets": "checklist,weight,profile"
}
Response
HTTP/1.1 200 OK
[
{
"profileId": 12,
"rowIndex": 1,
"widgets": "checklist,weight,profile"
}
]
Updates row information for a given profile ID.
PUT /profile/{id}/rowInfo
Content-Type: application/json
{
"rowIndex": 1,
"widgets": "checklist,profile,weight"
}
Response
HTTP/1.1 200 OK
[
{
"profileId": 12,
"rowIndex": 1,
"widgets": "checklist,profile,weight"
}
]
Deletes row information for a given profile ID and row index.
DELETE /profile/{id}/rowInfo/{index}
Response
HTTP/1.1 204 No Content
Note
This section is currently in progress!