Limiting courses from API to a particular Term

Jump to solution
conrad_perfett
Community Novice

Currently I am using a search term which seems to work since we prefix the sis course id with the term.

string CoursesUrl = @"https://texassouthmostcollege.test.instructure.com/api/v1/accounts/self/courses";

nvc2.Set("search_term", "2018SP");
client2.QueryString = nvc2;
byte[] responseBinary = client2.DownloadData(CoursesUrl);
string response = Encoding.UTF8.GetString(responseBinary);
courses = JsonConvert.DeserializeObject<List<Course>>(response);

Is this currently the only way to limit by term or is there another way I am missing a better way?

Advice is appreciated in this as I have very limited experience with using C# to access REST APIs

1 Solution
ColinMurtaugh
Community Champion

Hi Conrad --

Yes -- you can include the "enrollment_term_id" parameter to limit the results to a particular term. The value would be Canvas' numeric ID for the term you're looking for.  

There are a bunch of parameters that can be used with that API call to further filter/customize the results:

Accounts - Canvas LMS REST API Documentation 

Hope this helps!

--Colin

View solution in original post