I have a login route that should transmit its input parameters as POST variables. I have defined my route like this:
POST /v1/accounts/login controllers.v1.Accounts.login(username: String, password: String)
and my Controller is like this:
object Accounts extends Controller {
def login(username: String, password: String) = Action {
Ok("Foo " + username)
}
}
When I test this route using Chromes Advance REST Client it only works for GET parameters and not if I send it as application/x-www-form-urlencoded POST form data.
The Play Framework documentation never actually mentions POST parameters but neither does it say that it does not work.
I think it might get it to work if I create a Form and bind my request to that but that seems needlessly complex.
Is there really no way to bind POST parameters using the routes file?
If the action method defines some parameters, all these parameter values will be searched for in the request URI, either extracted from the URI path itself, or from the query stringso I guess it really does not work with POST parameters. - Mattias