cancel
Showing results for 
Search instead for 
Did you mean: 
erik_gustafson
Surveyor II

Root Outcome Group API Giving a 401 Response

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-ac... 

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 )

401 api return.png

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. 

 

Labels (3)
0 Kudos
2 Replies
dgrobani
Adventurer III

@erik_gustafson, did you ever find a solution to your issue? I did a lot of work with outcomes and outcome groups using Python via the API a few years ago. I've been hoping to find/make time to refresh my memory on all that and see if I could offer you anything helpful, but that unfortunately hasn't happened and seems unlikely to happen anytime soon.

erik_gustafson
Surveyor II

@dgrobani ,

Unfortunately, no I have not found a solution to the issue. Like I mentioned in the post, Canvas Support said everything was working normally, but I always get an error when trying to use the root_outcome_group endpoint. But the weird thing is, it activates the metadata for the course outcomes. 

I was hoping someone would have a solution, since it does work when you paste the endpoint into a browser URL. I just can't get it to work when I am in PowerShell.