Celebrate Excellence in Education: Nominate Outstanding Educators by April 15!
Found this content helpful? Log in or sign up to leave a like!
I have been given a requirement to programmatically cross list sections using the REST API. I found a course that has no cross listed sections. I made the API call to cross list one of them and it didn't appear to work. I made the same call using Postman and got the same results.
Is there a log I can view that would give me details on what happened? Is there detailed documentation?
Hi @68muscle,
Can you tell us what API call you tried making, and perhaps what error message you got back from Canvas/Postman? Also, are you already somewhat familiar with the Canvas API, or starting from the beginning with this task as your first try?
The Section Crosslist API is fairly straightforward. You'd just need make a post call in the format /api/v1/sections/:id/crosslist/:new_course_id. The :id is the canvas section id (not the sis_id) of the section, and similarly, the :new_course_id is the canvas course id for the course where you want the section to end up crosslisted to. I have a feeling it's one of these two things that might be tripping your call up. If you can provide an example of what you did, it might be easier to point the problem or walk you through things though.
Hope to hear back from you soon!
-Chris
Chris,
I have used the API to success for other tasks. This is my first time using the API to do a cross-listing.
Here is the data I pulled out of our test version of Canvas:
RowIndex | CourseID | SectionID | SectionName | Comments |
0 | 1402440 | 1485805 | p04 - Making Connection I - Battley | ********** New set of courses. ********** |
1 | 1402440 | 1485815 | p07 - Making Connection I - Battley | ***** API call to cross list 1485815 into 1402440 |
I am using the RestSharp C# library. Here's my code:
var client = new RestClient(_configuration.GetSection("Endpoints:Test").Value);
course_id: "1402440"
end_at: null
id: 1485815
integration_id: null
name: "p07 - Making Connection I - Battley"
nonxlist_course_id: null
restrict_enrollments_to_section_dates: "false"
sis_course_id: "2024_S1_115_EL9CNC_001"
sis_import_id: "5628070"
sis_section_id: "192681.0.05"
start_at: null
total_students: ""
Am I wrong to assume nonxlist_course_id should be populated after the call?Hi @68muscle,
In your table, is that the existing data in your Canvas instance? If so, it appears both of the sections listed there (1485805 and 1485815) are already assigned to the same course (1402440). While I'm not familiar with C#, I can get the basic idea that your code is telling Canvas to crosslist section 1485815 into course 1402440. Assuming that's the case and your table is the existing data, the section is already/originally assigned to the course you're crosslisting it to so crosslisting request basically does nothing. If you have a different course to crosslist the section into, the call would likely work and you should see the nonxlist_course_id field be the original course the section was assigned to and the course_id be the new course it was crosslisted into.
I hope this makes some sense!
-Chris
To participate in the Instructure Community, you need to sign up or log in:
Sign In