REST API how to associate to blueprint course

Jump to solution
wjlane
Community Participant

We are trying to automate the process of associating courses to blueprint courses.  The workflow we want to implement is to have a form in our website where the director of elearning submits a csv file which creates the associations.  We already have something similar for creating assignments.  To achieve this we are looking at "Update associated courses"  (https://canvas.instructure.com/doc/api/blueprint_courses.html#method.master_courses/master_templates...) but I assume we must be missing something simple because whatever we try it returns "The specified resource does not exist".  The documentation provides the following path :

PUT /api/v1/courses/:course_id/blueprint_templates/:template_id/update_associations


We're assuming the issue relates to the course or blueprint_template id.  It seems unlikely to me that the course id and the course_ids_to_add would be the same.  So should the course id be the blueprint course id?  If that is the case then what is the template_id and where would we find that?

https://somewhere.beta.instructure.com/api/v1/courses/5475/blueprint_templates/6641/update_associati...

If anyone has any experience or insight into this it would be greatly appreciated.

N.B The above url is used in Postman and consequently it will make the necessary substitutions to ensure the url format is valid (e.g the ending will be &course_ids_to_add%5B%5D=5475 but have left as is for clarity).

Labels (1)
1 Solution
MattHanes
Community Champion

I just tested this out since I'm going to probably have to start using this at some point. According to the API documentation, the "template id" for now is just the word "default". Here's what the documentation says:

Using 'default' as the template_id should suffice for the current implmentation (as there should be only one template per course). However, using specific template ids may become necessary in the future

So in the Put command, you're deciding what courses to associate with a blueprint course. All the association stuff happens in the blueprint course so the "course_id" is the course id for the blueprint. The "courses ids to add" array lists all the courses you want associated with the blueprint.

For example, if the blueprint course is 1111 and you want to associate course 1112 then the url in Postman will look like this:
242244_pastedImage_2.png

View solution in original post