title: Short Answer Submission Using Google Classroom API
body: <p>I am trying to <code>SHORT_ANSWER_SUBMISSION</code> for an <code>coursework</code> via Google Classroom API.</p>
  <p>For an patch request for a course the user must be under the same domain and have to have permission for edit content. All criteria has been fulfilled.</p>
  <p>Coursework is posted by teacher@domain.com and <code>SHORT_ANSWER_SUBMISSION</code> is done from student@domain.com</p>
  <p>but it returns</p>
  <pre><code>        &quot;status&quot;: 500,
          &quot;type&quot;: &quot;Google_Service_Exception&quot;,
          &quot;messages&quot;: [
              &quot;{\n  \&quot;error\&quot;: {\n    \&quot;code\&quot;: 400,\n    \&quot;message\&quot;: \&quot;updateMask: updateMask may only contain \\\&quot;draftGrade\\\&quot; or \\\&quot;assignedGrade\\\&quot;.\&quot;,\n    \&quot;errors\&quot;: [\n      {\n        \&quot;message\&quot;: \&quot;updateMask: updateMask may only contain \\\&quot;draftGrade\\\&quot; or \\\&quot;assignedGrade\\\&quot;.\&quot;,\n        \&quot;domain\&quot;: \&quot;global\&quot;,\n        \&quot;reason\&quot;: \&quot;badRequest\&quot;\n      }\n    ],\n    \&quot;status\&quot;: \&quot;INVALID_ARGUMENT\&quot;\n  }\n}\n&quot;
          ]
      }
  
  </code></pre>
  <p>Which should given, when teacher submit assigedGrade or draftGrade via same api</p>
  <p>this is my submission object</p>
  <pre><code>Google_Service_Classroom_StudentSubmission {#1362
    #collection_key: &quot;submissionHistory&quot;
    +alternateLink: null
    +assignedGrade: null
    #assignmentSubmissionType: &quot;Google_Service_Classroom_AssignmentSubmission&quot;
    #assignmentSubmissionDataType: &quot;&quot;
    +associatedWithDeveloper: null
    +courseId: null
    +courseWorkId: null
    +courseWorkType: null
    +creationTime: null
    +draftGrade: null
    +id: null
    +late: null
    #multipleChoiceSubmissionType: &quot;Google_Service_Classroom_MultipleChoiceSubmission&quot;
    #multipleChoiceSubmissionDataType: &quot;&quot;
    #shortAnswerSubmissionType: &quot;Google_Service_Classroom_ShortAnswerSubmission&quot;
    #shortAnswerSubmissionDataType: &quot;&quot;
    +state: null
    #submissionHistoryType: &quot;Google_Service_Classroom_SubmissionHistory&quot;
    #submissionHistoryDataType: &quot;array&quot;
    +updateTime: null
    +userId: null
    #internal_gapi_mappings: []
    #modelData: []
    #processed: []
    +&quot;shortAnswerSubmission&quot;: Google_Service_Classroom_ShortAnswerSubmission {#1363
      +answer: &quot;abc&quot;
      #internal_gapi_mappings: []
      #modelData: []
      #processed: []
    }
  }
  </code></pre>
  <p>And i used this method</p>
  <pre><code>$data = $request-&gt;all();
  $client = setGoogleClient(getOAuthToken());
          $class = new \Google_Service_Classroom($client);
  $submission = setShortAnswerSubmission($data);
  $response = $class-&gt;courses_courseWork_studentSubmissions-&gt;patch($courseId, $courseWorkId, $id, $submission);
  </code></pre>
  <p>How to submit <code>SHORT_ANSWER_SUBMISSION</code> via google classroom API. is it possible?? Couldn't find any other than this.</p>