September 2018
Intermediate to advanced
398 pages
9h 43m
English
To test the login endpoint, go to the WebService class and add the following annotations, just before the login definition:
@ApiOperation(value = "Login to the service", consumes = "text/plain")
@ApiImplicitParams(Array(
new ApiImplicitParam(
value = "Create a session for this user",
required = true,
dataType = "java.lang.String", // complete path
paramType = "body"
)
))
@ApiResponses(Array(new ApiResponse(code = 200, message = "login success"), new ApiResponse(code = 400, message = "Invalid user name supplied")))
def login() = Action { request =>
The ApiOperation object adds a description of the operation and defines the content type of the body sent. In this case, we are not sending JSON, but just a plain string. The ApiImplicitParams ...
Read now
Unlock full access