Why can't an assignment be set to 'not graded' via the API?

Jump to solution
ds264
Community Explorer

The API docs (https://canvas.instructure.com/doc/api/assignments.html) don't list 'not_graded' as a possible option for assignment[grading_type] even though this is an allowable option via the web interface.  I tried creating/modifying an assignment with this grading type via the Create/Edit API methods, and even though the returned Assignment object reports the correct grading type, it is still listed as the default Percentage grading type on the course site, and still appears in the gradebook until I manually edit the assignment to be not graded via the web interface.  

So: any workarounds for this? Thanks.

PS: Yes, I do have a specific use case for having not graded assignments in my course and would like to algorithmically generate these without any manual intervention. 

Labels (1)
1 Solution
lawd
Community Participant

I did some work using Canvas's graphql api, and figured out how to accomplish what you are after. I have posted my graph query below if you are interested, but what I found was that you not only had to set the "gradingType to "not_grated", but you also had to set the "submissionTypes" to "not_graded." It wasn't until I set the submissionTypes that it finally worked.

I don't know if this is the same case for the v1 api, but you might give it a go. If not, the query below should work if you are using the graph api. 

mutation MyMutation {
   __typename
   updateAssignment(input: {id: "<assignment_id>", gradingType: not_graded, submissionTypes: not_graded}) {
      assignment {
         _id
         name
      }
   }
}

View solution in original post