public function create_item($request) { $params = $request->get_params(); $question_id = $params['question_id']; $value = $params['value']; $response = new \WeBWorK\Server\Response(); $response->set_author_id(get_current_user_id()); $response->set_content($value); $response->set_question_id($question_id); if ($response->save()) { $retval = array('responseId' => $response->get_id(), 'content' => $response->get_content(), 'authorAvatar' => $response->get_author_avatar(), 'authorName' => $response->get_author_name()); $r = rest_ensure_response($retval); $r->set_status(201); } else { $r = rest_ensure_response(false); $r->set_status(500); } return $r; }