update_grades API endpoint: get information on partial success/failure

matt_price
Community Explorer

I'm looking to reduce the number of API calls I make by switching from the

PUT /api/v1/courses/:course_id/assignments/:assignment_id/submissions/:user_id

endpoint to this one:

POST /api/v1/courses/:course_id/assignments/:assignment_id/submissions/update_grades

the update_grades returns a Progress, whose progress you can then check.  However, that Progress returns far less information than the old API call did. Most importantly, when one part of the JSON payload has an error, the request can fail with a `completion` property of null and a `workflow_state` of failed. But the correctly-formed parts of the payload wil lstil update grades for those users. Also I don't get back comment_id's from the individual posted comments. 

 

So for instance, with a payload of:

{"grade_data": {"nonsensestring": {"posted_grade": 44} , 
"myintegrationid": {"posted_grade":95},
"myactualcanvasid": {"posted_grade": 25, "text_comment": "pretty terrible work here, price"}}}

The Progress will report failure as follows:

{
"id": 1561993,
"context_id": XXXXX,
"context_type": "Course",
"user_id": null,
"tag": "submissions_update",
"completion": null,
"workflow_state": "failed",
"created_at": "2021-11-03T13:22:48Z",
"updated_at": "2021-11-03T13:22:52Z",
"message": "Couldn't find User(s) with API ids 'nonsensestring', 'myintegrationid'",
"url": "https://q.utoronto.ca/api/v1/progress/1561993"
}

So, I can potentially extract the *failed* postings, but there's no list of the *successful* postings. And it would be nice to have the comment id so I can potentially update one comment rather than submit one comment after another. 

Is there any hope that I can get this information back somehow?

Thanks!

Labels (2)
0 Likes