Google Classroom API-补丁草稿等级

时间:2019-02-10 22:21:25

标签: google-api google-api-php-client google-classroom

大家好,这让我发疯了,希望您能帮忙

我正在尝试使用patch()将草稿成绩分配给作业,但是不断收到错误(补丁)未知参数:'draftGrade'

这是我在laravel PHP中创建的代码

$this->client->setAccessToken($_SESSION['access_token']);
        $service = new \Google_Service_Classroom($this->client);
        $courseId = '17531696064';
        $courseWorkId = '29297231820';
        $id = 'CgwI9aG3lwkQzI-Bkm0';
        $post_body = new \Google_Service_Classroom_StudentSubmission(array(
            'updateMask' => 'draftGrade',

        ));
        $opt_params = array(
            'draftGrade' => 90,
        );
        $list = $service->courses_courseWork_studentSubmissions->patch($courseId, $courseWorkId, $id, $post_body, $opt_params);

我也使用了以下内容,但仍然不满意。

$list = $service->courses_courseWork_studentSubmissions->patch(17531696064,
            29297231820,
            'CgwI9aG3lwkQzI-Bkm0',
            new \Google_Service_Classroom_StudentSubmission(array('updateMask' => 'draftGrade')),
            array ('resource' =>['draftGrade' => 90] ));

任何帮助都会很棒。

1 个答案:

答案 0 :(得分:1)

您做错了两件事之一:-

  1. 您必须将update mask ='assignedGrade'作为查询参数以及在requestBody中传递。
  2. 对我有用的是,我首先分配了一个等级作为草稿等级,并且在下一个请求中分配了与draftGrade相同的等级,并分配了Grade,然后更改了StudentSubmit的等级,还返回了提交的内容。