Blueprint attribute of GET Course api always returns false
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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