POST request using play ws in Scala

You need to import BodyWritables for json objects, Add following import statements to your source file

import play.api.libs.ws.JsonBodyReadables._
import play.api.libs.ws.JsonBodyWritables._

For more information have a look at official documentation


The current accepted answer does not work in Scala Play 2.7.x (possibly some earlier versions as well).

I couldn't find it in the docs, but you need to explicitly call asScala on the ws object. For example:

  val data = Json.obj("message" -> "How are you?")
  ws
    .asScala()
    .url("http://someurl.com")
    .post(data)
    .map(response => {
      //do something with response
    })

Note: this also returns a scala future instead of a java completion stage.