I\'m trying to perform a post with play.api.libs.ws.WS but I can\'t figure out how to set the params, my code:
Promise promise = WS.url(Play.
The accepted answer is wrong, or at least misleading. The code
WS.url("http://localhost:9001")
.setQueryParameter("param1", "foo")
.setQueryParameter("param2", "bar")
.post("content");
will post the string content
to http://localhost:9001/?param1=foo¶m2=bar
, which is almost certainly not what the OP wanted. What is much more likely to work is
WS.url("http://localhost:9001")
.post(Map("param1" -> Seq("foo"),
"param2" -> Seq("bar")))
which posts the form param1=foo¶m2=bar
to the the URL http://localhost:9001
, which is typically what the server wants.