AnsweredAssumed Answered

Sync Blueprint courses via API

Question asked by Nan Schutz on Sep 11, 2018
Latest reply on Sep 12, 2018 by Nan Schutz

Recently we made a across the board change to all the blueprint courses and therefore need to trigger the unsynced changes so the associated courses get updated as well. The API is provided to do that and I tested it successfully in Postman, updating 1 course at a time.

POST /api/v1/courses/:course_id/blueprint_templates/:template_id/migrations


However, when I have to run this for all the blueprint courses, it only executed a few courses at a time as if there were a limit enforced somewhere. I increased the timeout value from 30 to 600 and still only the same number of courses were synced. Does anyone know where the limit comes from? How to increase it? or how to work around this so I can run the script once for all the 100+ blueprint courses?


Below is my PHP code snippet.

// this page will run force sync on the supplied blueprint courses.
$courseIDs = array(xxx, xxx, xxx); //the array contains over 100 course ids
$length = count($courseIDs);
for($i = 0; $i < $length; ++$i) {
    $cid = $courseIDs[$i];
    $postURL = "domainurl" . $cid . "/blueprint_templates/default/migrations";
    $curl = curl_init();

    curl_setopt_array($curl, array(
      CURLOPT_URL => $postURL,
      CURLOPT_TIMEOUT => 600, //increased from 30
      CURLOPT_HTTPHEADER => array(
        "Authorization: Bearer xxxxx
        "Cache-Control: no-cache",

    $response = curl_exec($curl);
    $err = curl_error($curl);