I need to validate my request parameter in rest API . I use a DTO class first I use requestbody and passing the String encrypted value (I encrypted my json request) then send through postman. latter I decrypt the requestData .
Let us consider My Json request like :
/Json Request/
{
"firstName":"Raushan",
"email":"email12345@gmail.com",
"age":"25",
"salary":"89.90",
"status":"1",
}
/*I send them postman like this */
method:post: url : localhost:8056/addUser
{
"encryptedReq":"hjafbsfbgsyfyewf9903-jnjcnskdsd=/*ds7s412345/85*9665545"
}
I handle my controller this :
public @ResponseBody ApiResponseDto addBeneficiar(@RequestBody String encryptedReq)
Now I want that if i send some value is null then I want to return response with : "firstName value should not be null"
so How can I do this @javathecup @javadmoradii @javadev16
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (0)