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);
var request = new RestRequest($"api/v1/sections/{section_id}/crosslist/{course_id}", Method.Post);
request.AddHeader("Authorization", "Bearer " + _configuration.GetSection("Secrets:AccessTokens:Test").Value); // The space after Bearer is important.
RestResponse<CanvasSection> response = client.Execute<CanvasSection>(request);
if (response.StatusCode == System.Net.HttpStatusCode.OK)
{
newSection = JsonConvert.DeserializeObject<CanvasSection>(response.Content);
}
course_id = 1402440
section_id = 1485815
This is what is contained in newSection when the call finishes:
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?
Thanks for the help.