I am building a RESTful API in Play and I am getting a strange error with my routes:
# Routes
# This file defines all application routes (Higher priority routes first)
# ~~~~
# Home page
GET / controllers.Application.index()
GET /api/getMessages controllers.Application.getMessages()
POST /api/createMessage controllers.Application.createMessages(from:String, subject:String, message:String)
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
The /api/createMessage is giving me some problems, when I post a full payload to it I get the error:
For request 'POST /api/createMessage' [Missing parameter: from]
Controller:
public static Result createMessages(String from, String subject, String message){
Message.create(from, subject, message);
return ok(toJson("ok"));
}
Request body:
Request Url: http://localhost:9000/api/createMessage
Request Method: POST
Status Code: 400
Params: {
"from": "[email protected]",
"subject": "Hello",
"message": "World"
}
Can anybody help me out?