AnsweredAssumed Answered

unable to create assignment from canvas api

Question asked by Ankur Gupta on Apr 16, 2016
Latest reply on Apr 19, 2016 by James Jones

i am trying the following code for creating new assignment from canvas api. Can anyone help me and suggest where i am going wrong.

i am continuously getting error array as a result;


$assignment['name'] = "Assignment1";

$assignment['submission_type'][] = "none";

$assignment['points_possible'] = "100";

$assignment['grading_type'] = "points";

$assignment['muted'] = true;

$assignment['published'] = false;


$domain = "";


$query = "/api/v1/courses/1016025/assignments";

$result = executeQuery("POST",$query,$assignemnt)


function executeQuery($method,$query,$data)


     global $domain;

     global $token;

     $vals = 3;

      $ch = curl_init('https://'.$domain.$query.'?access_token='.$token);

       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

       curl_setopt($ch, CURLOPT_HEADER, 0);

       curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

       curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method);

       curl_setopt($ch, CURLOPT_POSTFIELDS, $data);

       $response = curl_exec($ch);

       return json_decode($response,true);