Blueprint attribute of GET Course api always returns false

Jump to solution
lyleh
Community Member

I am trying to mark courses as blueprint courses via the api. I am using Powershell and to start I am using curl do a GET as follows:

curl -H @{"Authorization" = "Bearer <token>"} -Method GET "https://canvas.instructure.com/api/v1/courses/<id>"

This call always returns blueprint=false.

I have tried doing an update via curl

curl -H @{"Authorization" = "Bearer <token>"} -Method PUT -Body "course[blueprint]=true" "https://canvas.instructure.com/api/v1/courses/<id>"

I can change the Name and other attributes. I also can change the Blueprint setting in the Canvas UI but the GET still returns blueprint=false.

Any guidance welcome.

 

 

 

Labels (3)
0 Likes
1 Solution
lyleh
Community Member
Author

Xavier 

Thanks for the answer. Unfortunately I am using Powershell so -F didn't work but when I researched what the difference was between -Body and -F I found what worked for me. I had to add a -ContentType.

$postParams = @{"course[blueprint]"="true"}
$res = @{"Authorization" = "Bearer <token>"} -Method PUT -Body $postParams -ContentType application/x-www-form-urlencoded "https://<canvasurl>/api/v1/courses/101"
$res.Content

That worked for me and I saw the updates immediately reflected in Canvas UI.

Lyle

View solution in original post