I have been working on an Outcomes script to help facilitate our accreditation efforts. Part of the script involves adding Outcomes to courses automatically, but in order to do this, I need to get the Root Outcome Group ID for a course to put the Outcomes into based on the information from this community posting: https://community.canvaslms.com/t5/Developers-Group/Outcome-group-missing-id-until-course-is-quot-active-quot/td-p/178339
I am using the Redirect to root outcome group for context endpoint (GET /api/v1/courses/:course_id/root_outcome_group).
Using this endpoint in a browser directly and via the Canvas Live API works every time as intended. However, when I try to use this endpoint in Powershell (which is what we use for our Canvas API calls), I get a 401 Unauthorized return every time.
(https://xxxx.instructure.com/api/v1/courses/######/root_outcome_group )

The interesting thing is that after I use the endpoint and get the 401, I can get the Root Outcome Group ID for the course, even though the return was a 401.
Has anyone else experienced an issue like this when trying to access this specific endpoint programmatically? I contacted Canvas Support, but they said they couldn't help because it was a custom script, and because it works in the browser as expected.
I am at a loss right now on what to do. I don't want to keep using the endpoint if I am getting a 401. I don't know if the API would reject my token eventually if I only get a 401 from it.
Any help would be greatly appreciated.