Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

If the credit type being awarded is associated with a credit reporter, such as ABIM MOC or others, the credit will be reported. 

Code Block
languagephp
linenumberstrue
<?php
// Verify the user does not exist in EthosCE
$curl = curl_init("http://your-domain.com/course_credit_awarded.json?uid=165&nid=393");
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "restws_webservice:webservice_password"); //Your credentials goes here
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);

$json = curl_exec($curl);
$response = json_decode($json);
$list = $response->list;

if (empty($list)) {
  // Send the creation request
  $course_credit_awarded = array(
      'nid' => 393, // Course
      'uid' => 165, // User
      'type' => 'ama', // The internal machine name of the credit type to award
      'credits' => 1, // Number of awarded credits
 );
  $curl = curl_init("http://your-domain.com/course_credit_awarded");
  curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'POST');
  curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/json"));
  curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
  curl_setopt($curl, CURLOPT_USERPWD, "restws_webservice:webservice_password"); //Your credentials goes here
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
  curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($course_credit_awarded));

  $json = curl_exec($curl);
  $response = json_decode($json);
  print_r($json);
}


A successful awarded credit creation creation request returns the following:

true
Code Block
linenumbers
{"uri":"http:\/\/your-domain.com\/course_credit_awarded\/214","id":"214","resource":"course_credit_awarded"}
Info

For an explanation of the information returned from the requests, see Web Service Responses.