This question is about best practice and not about problem.
I am writing a spring boot
rest service that will perform update meaning basically i am doing POST
operation. The input parameters are something like userId
,name
,emailAddress
,phoneNo
.
So my question is, can i do something like below. Just use POST
to tell this is update uri
but pass all parameters as request param instead of requestBody
@PostMapping(value="/my-url )
public ResponseEntity<?> myMethod(
@RequestParam(value = "userId") String userId,
@RequestParam(value = "name") String name,
@RequestParam(value = "emailAddress") String emailAddress,
@RequestParam(value = "phoneNo") String phoneNo){
I know this works but, is this acceptable ? If this is okay , what is the purpose of using request type as POST
if we are passing parameters in the form of requestparam.
Expert view is appreciated.