P
P
Pavel Dudenkov2016-10-03 14:59:12
Java
Pavel Dudenkov, 2016-10-03 14:59:12

How to write proper curl for method from Spring MVC Controller?

Good day to all,

@ResponseBody
      public UserDto editUser(
@Valid @RequestBody UserDto user,
@RequestParam(value="doSendTempPassword", required = false, defaultValue = "false")
boolean doSendTempPassword)

How to write a correct Curl request for such a rest method to pass boolean doSendTempPassword = true ?
I tried different ways, but in the end I constantly got the default false.
For example:
curl -v -S -u admin:admin123 -X POST -H 'Content-Type: application/json' 
-d'{"username":"chuck","firstName":"Chuck","lastName":"Norris",
"mail":"[email protected]","authority":"TENANT_USER"}' 
-d'true' 
"http://localhost:8080/rest/api/user" | python -mjson.tool

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
protven, 2016-10-03
@viperz

So you are passing a parameter in the body.
And RequestParam is
localhost:8080/rest/api/user?doSendTempPassword=true

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question