"This can only be done by the logged in user.", httpMethod = "PUT") @ApiResponses(Array( new ApiResponse(code = 400, message = "Invalid username supplied"), new ApiResponse(code = 404, message = "User not found"))) @ApiImplicitParams(Array( new ApiImplicitParam (name = "username", value = "name that need to be updated", required = true, dataType = "String", paramType = "path"), new ApiImplicitParam(name = "body", value = "Updated user object", required = true, dataType = "models.User", paramType = "body"))) def updateUser(username: String) = Action { implicit request => request.body.asJson match { case Some(e) => { val user = Json.mapper.readValue(e.toString, classOf[User]) userData.addUser(user) JsonResponse(user) } case None => JsonResponse(new value.ApiResponse(400, "Invalid input")) } }