Final Grade Override GraphQL

Document created by Erin Hallmark Administrator on Jun 28, 2019
Version 1Show Document
  • View in full screen mode

Final Grade Override is supported via the GraphQL API. 

 

Setting final grade overrides or requesting final grade override data can only be done via a GraphQL endpoint. Accessing the endpoint can be done with any client that can make HTTP requests.

 

GraphQL endpoints can be accessed using one of two methods: GraphiQL and cURL.

GraphQL endpoint permissions mirror permissions for the Canvas API. A user is only granted access to view grades based on that user’s permissions. For instance, a student cannot view grades for another student, but an instructor can view grades for any student in a course.

GraphiQL

Set Override Score Mutation

For final grade overrides, locate the Mutation section and select the setOverrideScore checkbox. 

 

By default, this option includes a required input value for enrollmentID, which will be automatically selected. Required values are indicated by an asterisk. 

 

The GraphiQL displays the skeleton query for the required enrollment ID:

mutation {

  setOverrideScore(input: {enrollmentId: "1", gradingPeriodId: "2", overrideScore: 97})

}

Set Input Fields

For the enrollmentID option, change the enrollment ID to be the enrollment ID of the student whose override score you would like to view. Change the enrollment ID directly in the sidebar.

 

To apply the override score to a specific grading period, select the gradingPeriodID checkbox and enter the grading period ID.

 

To add an override score, select the overrideScore checkbox and enter the score value. For instance, the student could receive an override grade of 97. 

 

With all mutation values included, the GraphiQL window displays the updated query:

mutation {

  setOverrideScore(input: {enrollmentId: "1", gradingPeriodId: "2", overrideScore: 97})

}

Select Return Fields

Once the purple input fields have been selected, identify the intended return fields.

 

Additional field options within the setOverrideScore mutation include the following:

  • Errors: display error generated while generating the query
  • Grades: display various grade views in the query results

 

Each option can be expanded to view all additionally included fields. For instance, grades is a complex type in GraphQL and includes 11 additional fields. The gradingPeriod field includes a set of its own fields that can be selected to specify a grading period.

 

View the GraphiQL window based on the selected fields:

mutation {

  setOverrideScore(input: {enrollmentId: "1", gradingPeriodId: "2", overrideScore: 97}) {

    errors {

      message

    }

    grades {

      overrideScore

      overrideGrade

      gradingPeriod {

        _id

        endDate

        startDate

   }   

  }  

 } 

}

 

Run Query

In the GraphiQL window menu bar, click the Run button. 

 

The window should generate results similar to this example:

{

  "data": {

    "setOverrideScore": {

      "errors": null,

      "grades": {

        "overrideScore": 97,

        "overrideGrade": "A",

        "gradingPeriod": {

          "_id": "2",

          "endDate": "2018-11-10T23:59:59-06:00",

          "startDate": "2018-11-01T00:00:00-05:00"

     }   

    }  

   } 

  }

}

 

cURL

The same steps above can be accomplished using cURL, using the above GraphiQL example:

curl \

  -X POST \

  -H "Content-Type: application/json" \

  -H "authorization: Bearer YOUR_TOKEN_HERE" \

  --data '{"query":  "mutation {

    setOverrideScore(input: {enrollmentId: 11, gradingPeriodId: 2, overrideScore: 97}) {

      errors {

        message

      }

      grades {

        overrideGrade

        overrideScore

        gradingPeriod {

          _id

          endDate

          startDate

      }  

     } 

    }

   }"}' \

  https://YOUR_INSTITUTION.instructure.com/api/graphql

Attachments

    Outcomes