cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
matthew_r_mcgol
Community Contributor

Associate Term to Grading Period via API

Jump to solution

I'm wondering if anyone knows if there is an API endpoint that enables admins to associate a term to a particular grading period. There are endpoints for creating/managing enrollment terms and for creating/managing grading periods but can't seem to find a way to use the APIs to link a term to a grading period in the same fashion.

Any suggestions would be most appreciated as we have hundreds of terms that need to be associated to a grading period based on how our gradebook/SIS integration operates.

Matt

1 Solution

Accepted Solutions

We were looking for a way to attach several terms to a grading period all at once rather than linking via the UI one by one. Through the use of Chrome Developer Tools we determined that there is a PATCH request that can be made using the Grading Periods endpoint (/api/v1/accounts/1/grading_period_sets/id). The payload should include an array of the enrollment term IDs that you want to link to the particular grading period. For example, this is the list of term IDs I needed to attach to a given grading period as shown in the cURL request:

...{"grading_period_set":{"title":"Semester 2 [2018-2019]","weighted":false,"display_totals_for_all_grading_periods":false},"enrollment_term_ids":["488","490","492","494","496","498","500","502","558","560","562","564","566","568","574","580","582","584","586","592","594","596","598","600","602","604","482"]}' 

Let's say we needed to add another term (ex. 123) to the grading period. We determined that we could add the term ID to the end of the enrollment_term_ids array and run the cURL request within Terminal in order link the term to the grading period. The cURL request would be updated as so: 

...{"grading_period_set":{"title":"Semester 2 [2018-2019]","weighted":false,"display_totals_for_all_grading_periods":false},"enrollment_term_ids":["488","490","492","494","496","498","500","502","558","560","562","564","566","568","574","580","582","584","586","592","594","596","598","600","602","604","482","123"]}' 

It was a huge time saver once we realized this as we had over 130 elementary schools to link to a "Year Long" grading period!

Hopefully this helps and I'd be happy to provide more specifics for those interested.

Matt

View solution in original post

5 Replies
kona
Community Coach
Community Coach

 @matthew_r_mcgol , greetings! Due to the technical nature of your question, I’m going to share it with the Canvas Developers‌ group in the Community. They are the ones who do the majority of the back-end API stuff in Canvas and should be able to help answer your questions. 

You might also comsider joining this group so you have access to their resources and information. 

Hope this helps get you closer to a solution!

Kona

Stef_retired
Community Team
Community Team

Hi,  @matthew_r_mcgol ‌, we're hopeful that you have arrived at a resolution to this issue, so for now, we've marked this question as Assumed Answered. If you have a solution you are willing to share, please post it—and if you still need assistance, feel free to post a follow-up comment to prompt our Community members to continue to ponder the question.

Thanks for checking stefaniesanders I didn't get a response via the community but with the help with one of our engineers we were able to uncover an undocumented API call via Chrome Developer Tools to make quick work of this! I did share the tip with our CSM in the hopes that it gets added to the API set at some point. With one cURL request using Terminal I was able to link a bunch of terms to a grading period. I'll look through my notes to find the steps and post them to this thread.

Thank you,  @matthew_r_mcgol —that would be great! We've temporarily removed the Assumed Answered designation from this discussion, and look forward to marking your next post with Correct Answer. Smiley Happy And, once it's up, we'll share it more broadly so other Canvas admins and developers can benefit from it.

We were looking for a way to attach several terms to a grading period all at once rather than linking via the UI one by one. Through the use of Chrome Developer Tools we determined that there is a PATCH request that can be made using the Grading Periods endpoint (/api/v1/accounts/1/grading_period_sets/id). The payload should include an array of the enrollment term IDs that you want to link to the particular grading period. For example, this is the list of term IDs I needed to attach to a given grading period as shown in the cURL request:

...{"grading_period_set":{"title":"Semester 2 [2018-2019]","weighted":false,"display_totals_for_all_grading_periods":false},"enrollment_term_ids":["488","490","492","494","496","498","500","502","558","560","562","564","566","568","574","580","582","584","586","592","594","596","598","600","602","604","482"]}' 

Let's say we needed to add another term (ex. 123) to the grading period. We determined that we could add the term ID to the end of the enrollment_term_ids array and run the cURL request within Terminal in order link the term to the grading period. The cURL request would be updated as so: 

...{"grading_period_set":{"title":"Semester 2 [2018-2019]","weighted":false,"display_totals_for_all_grading_periods":false},"enrollment_term_ids":["488","490","492","494","496","498","500","502","558","560","562","564","566","568","574","580","582","584","586","592","594","596","598","600","602","604","482","123"]}' 

It was a huge time saver once we realized this as we had over 130 elementary schools to link to a "Year Long" grading period!

Hopefully this helps and I'd be happy to provide more specifics for those interested.

Matt

View solution in original post