The Instructure Community will enter a read-only state on November 22, 2025 as we prepare to migrate to our new Community platform in early December.
Read our blog post for more info about this change.
Found this content helpful? Log in or sign up to leave a like!
Hello.
Just a few days ago this code:
string command = "/api/v1/accounts/18/courses";
var courseData = new { name=courseName, course_format="blended", account_id= "18", start_at =startDate, ends_at=endDate};
string jsonContent = JsonConvert.SerializeObject(new { course = courseData });
var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");var response = await httpHelperCanvas.PostCommandAsync(command, httpContent);
was creating a course in account #18, BUT today it creates a course in account #1
Have Instructure changed something in API? Any idea what's going on?
Additionally I have tried to update new course to move it in my account:
string command = "/api/v1/courses/<NewCourseId>";
var courseData = new { account_id="18" };
string jsonContent = JsonConvert.SerializeObject(new { course = courseData });
var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");var response = await httpHelperCanvas.PutCommandAsync(command, httpContent)
It returns 200 but doesn't do anything.
Thank you for any input!
========================================
Apparently there was an issue with the system.
Beta had stalled on several jobs, At the end of the day everything started working, and a bunch of my "lost" courses appeared without any further actions from me.
Thank you everybody for the help.
Solved! Go to Solution.
Apparently there was an issue with the system.
Beta had stalled on several jobs, At the end of the day everything started working, and a bunch of my "lost" courses appeared without any further actions from me.
Thank you everybody for the help.
The code was last changed a couple of years ago.
I'm just throwing some stuff out there, running late for a meeting and don't have time to fully think through or investigate...
Are you sure that account 18 still exists using GET /api/v1/accounts/18
Does the user account you're using have access to account 18?
Technically, the course.account_id is undocumented, but it's definitely in the code. There is something in the code that looks at that number, if specified, and compares it to the account_id specified in the path. If it's not the same it finds a child of the account. Have you tried it without the account_id inside the payload?
Thanks for quick reply.
>Are you sure that account 18 still exists using GET /api/v1/accounts/18
Yes. I should add 18 is a child account to 1
>Does the user account you're using have access to account 18?
I can do staff through UI...
>Have you tried it without the account_id inside the payload?
Yes. same result
Hi Alexei B,
I am doing something very similar and am not seeing the issue you are describing.
Are you only having issues with courses being created in the sub-account ID of 18? Is the code still working to create a course in say a sub-account with an ID of 17?
Unfortunately I don't have access to any other accounts. only 1 and 18.
Additionally I have tried to update new course to move it in my account:
string command = "/api/v1/courses/<NewCourseId>";
var courseData = new { account_id="18" };
string jsonContent = JsonConvert.SerializeObject(new { course = courseData });
var httpContent = new StringContent(jsonContent, Encoding.UTF8, "application/json");var response = await httpHelperCanvas.PutCommandAsync(command, httpContent)
It returns 200 but doesn't do anything.
Hi Alexei B,
I believe the issue is you're including the account_id="18" in your courseData. I don't believe this is necessary as you're specifying the account in your URL already and therefore not needed in the courseData string.
The parameters that I have in my courseData string are name, course_code, term_id, sis_course_id, time_zone and whether or not the course is marked as published upon creation.
Can you try removing the account_Id from your courseData string and see if that corrects the issue?
I did try removing account_id from the courseData and I added Offer="true" but that didn't change anything....
Apparently there was an issue with the system.
Beta had stalled on several jobs, At the end of the day everything started working, and a bunch of my "lost" courses appeared without any further actions from me.
Thank you everybody for the help.
Community helpTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in