AnsweredAssumed Answered

How do I post a grade to an assignment in Powershell?

Question asked by Gary Chow on Nov 23, 2016
Latest reply on Dec 5, 2016 by Gary Chow

I can grade a submission by API in cURL but cannot get it done in Powershell.

The grade cannot be updated after Invoke-RestMethod in Powershell but the same API call was successful in cURL.


Below is the code I tested:


$submission = @{"submission[posted_grade]"='100'}

$token="my token"

$url="my institution url"

$header = @{"Authorization"="Bearer "+ $token}

$json = $submisison | ConvertTo-Json

$ps_response = Invoke-RestMethod '$url/api/v1/courses/15424/assignments/33997/submissions/10' -Method Put -Body $json -ContentType 'application/json' -headers $header

$curl_response=curl.exe "$url/api/v1/courses/15424/assignments/33997/submissions/10" -H "Authorization: Bearer $token" -X PUT -F "submission[posted_grade]=100"