The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Hi,
I'm getting the following error from some of my users when they try to use the API to update their assignment:
{"hide_in_gradebook":[{"attribute":"hide_in_gradebook","type":"inclusion","message":"inclusion"},{"attribute":"hide_in_gradebook","type":"inclusion","message":"inclusion"}],"invalid_record":[{"attribute":"invalid_record","type":"Validation failed: Hide in gradebook is not included in the list, Hide in gradebook is not included in the list","message":"Validation failed: Hide in gradebook is not included in the list, Hide in gradebook is not included in the list"}]}'
I'm a little confused by this since the API documentation says that this field is optional:
From the docs (https://canvas.instructure.com/doc/api/assignments.html😞
// (Optional) If true, the assignment will not be shown in any gradebooks
"hide_in_gradebook": true,
Regardless, I explicitly added the hide_in_gradebook key before I posted to Canvas as can be seen from my function below:
public function updateAssignment(int $course_id, int $assignment_id, $assignment_info): array
{
$lms_access_token = $this->_updateAccessToken();
$url = "/api/v1/courses/$course_id/assignments/$assignment_id";
$data = [];
if (isset($assignment_info['name'])) {
$data['assignment[name]'] = $this->addADAPT($assignment_info['name']);
}
if (isset($assignment_info['instructions'])) {
$data['assignment[description]'] = $assignment_info['instructions'];
}
if (isset($assignment_info['total_points'])) {
$data['assignment[points_possible]'] = $assignment_info['total_points'];
}
if (isset($assignment_info['lms_assignment_group_id'])) {
$data['assignment[assignment_group_id]'] = $assignment_info['lms_assignment_group_id'];
}
if (isset($assignment_info['position'])) {
$data['assignment[position]'] = $assignment_info['position'];
}
if (isset($assignment_info['unlock_at'])) {
$data['assignment[unlock_at]'] = $assignment_info['unlock_at'];
}
if (isset($assignment_info['due_at'])) {
$data['assignment[due_at]'] = $assignment_info['due_at'];
}
if (isset($assignment_info['shown'])) {
$data['assignment[published]'] = $assignment_info['shown'];
}
$data['assignment[hide_in_gradebook]'] = false;
return $this->_doCurl($lms_access_token->access_token, 'PUT', $url, $data);
}
However, I'm still getting the error. Any help would be appreciated.
Thank you,
Eric
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in