Develop a REST API to moderate/validate the comment text to prevent customers from posting objectionable content. The REST API is expected to take a piece of text as an input and respond with feedback regarding objectionable content.
[POST] http://{host:port}/product/{product-id}/comment
"content-type": "application/json"
{
"comment": "{comment-text}"
}
{
"status": true,
"data": {
"productId": "{product-id}",
"comment": "{comment-text}",
"objectionable": "{true/false}"
}
}
{
"status": false,
"httpStatus": "INTERNAL_SERVER_ERROR",
"timestamp": "{current-time}",
"error": {
"code": "{failiure-code}",
"type": "{failiure-type} values: UNKNOWN/INPUT/CONFIG",
"message": "{failiure-reason}"
}
}
- Java 8
- Lombok plugin must be installed in Intellij
- Run Application.java to start the service. (or)
- Execure "mvn spring-boot:run" in terminal to start the service.