API documentation

MyEducationPath.com allows to generate certificates of course completion using the API (Application Programming Interface).

Education Provider can use Web interface to issue certificate of course completion for students. Use the API to integrate MyEducationPath.com in your eLearning system to issue certificates directly from the system.

API is the set of GET http requests. Responses are in JSON format. Every request to teh issuer API requires YOURAPIKEY. You can get the key on your education provider account settings page.

Read more about Certificates of course completion

If you use LMS Moodle then try our Moodle Plugin which uses this API.

Education Provider API

 

Get templates. getTemplates

Get list of certificate templates.

Request

http://myeducationpath.com/api/getTemplates/YOURAPIKEY/

Response

{"status":"ok","message":"Success","response":{"templates":{..(TRUNCATED)..}}}

Issue a certificate to a student. addCertificate

This API call creates a new certificate. The certificate has the link to view it on the web. And also the link to download printable version.

COURSEID - course id . It can be the ID in the MyEducationPath.com database or the ID in a local DB of the provider. It depends on the argument courseidtype (remote or local).

TEMPLATEID - template ID. If is 0 is missed then default course template will be used

Request

http://myeducationpath.com/api/addCertificate/YOURAPIKEY/?courseid=COURSEID&courseidtype=local&templateid=TEMPLATEID&name=STUDENTNAME&date=DATEONCERTIFICATE&code=CERTFICATEID&programshort=SHORTCOURSENAME&coursehours=HOURS&enddate=ENDDATEONCERTIFICATE&grade=GRADE&teacher=TEACHERNAME

Not all arguments are required. You should add to a request only arguments that are checked to be displayed on a certificate template.
Mandatory arguments:

courseid - course ID. The ID of the course in the directory. If courseidtype is 'remote' then COURSEID is ID in your eLeraning system. If courseidtype is 'local' or missed then COURSEID is ID of the course in the MyEducationPath DB;
Optional arguments:
templateid - ID of certificate template. If not provided then default template is used to generate the certificate. The ID can be get with API function getTemplates;
courseidtype - 'local' or 'remote' . If is missed then 'local' is used as default value;
name - name of the student to display on the certificate;
email - student email. The certificate can be owned by a student using his email;
date - date of certificate issuing to show on the certificate;
program - course name;
code - the certificate ID in local database. it is ID of the certificate in your internal records.;
programshort - short course name, usually used to display on logo image of the certificate;
coursehours - total hours count of the course;
enddate - date while the certificate is valid;
grade - grade the student get after the course;
techer - techer name;
emailuser - if this is 'y' then an email will be send to the email associated with the certificate with a link to view and print the certificate;

Response

{"status":"ok","message":"Success","response":{"certificate":{"id":208,"vendorid":"123","certificatelink":"http:\/\/{$config.maintitlelower}\/cert\/cert\/bab0aca96a0b532408b5d42c653c8ef3.htm ","printlink":""http:\/\/{$config.maintitlelower}\/page\/certificates.htm?view=pubcertpdf&uniqueurl=e3433329946abb9ce88acf144eba5593","..(TRUNCATED)..}}}

Delete a certificate. removeCertificate

This API call deletes a certificate

CERTFICATEID is ID of the certificate. The ID can be received when create the certificate or with API request getCertificates

Request

http://myeducationpath.com/api/removeCertificate/YOURAPIKEY/?id=CERTFICATEID

Response

{"status":"ok","message":"Success","response":[]}

Get a certificate information including view and print links. getCertificate

CERTFICATEID is ID of the certificate. The ID can be received when create the certificate or with API request getCertificates

Request

http://myeducationpath.com/api/getCertificate/YOURAPIKEY/?id=CERTFICATEID

Response

{"status":"ok","message":"Success","response":{"certificate":{"id":"38","vendorid":"13","courseid":"421","certificatelink":"http:\/\/{$config.maintitlelower}\/cert\/bab434396a0b532408b5d42c653c8ef3\/01284e1772.htm","printlink":"http:\/\/{$config.maintitlelower}\/page\/certificates.htm?view=pubcertpdf&uniqueurl=bab232396a0b532408..(TRUNCATED)..}}}

Get certificates. getCertificates

Get all certificates ossued by a provider.

Request

http://myeducationpath.com/api/getCertificates/YOURAPIKEY/

Response

{"status":"ok","message":"Success","response":{"certificates":{..(TRUNCATED)..}}}

Example of PHP library       Download

<?php
class {$config.justname} {
	var $apiendpoint='http://{$config.maintitlelower}/api/';
	var $apikey='';
	var $error='';
	var $templateid='0';
	var $courseidtype='local';
	var $emailuser=false;
	
	function __construct($apikey='')
	{
		$template->apikey=$apikey;
	}
	function checkAPIKey(){
		$resp=$template->executeAPICall('getAccountInfo');
		if($resp->status!='ok') return false;
		return true;
	}
	function executeAPICall($function,$options=''){
		$url=$template->apiendpoint.$function.'/'.urlencode($template->apikey).'/';
		$url.='?'.$options;

		$result=file_get_contents($url);
	
		$r=json_decode($result);
		if($r->status!='ok'){
			$template->error=$r->statusmessage;
		}else{
			$template->error='';
		}
		return $r;
	}
	function setTemplateID($id){
		$template->templateid=$id;
	}
	function setEmailUser($s){
		$template->emailuser=$s;
	}
	function setCourseType($t){
		if($t!='local') $t='remote';
		$template->courseidtype=$t;
	}
	function getCertificates(){
		$resp=$template->executeAPICall('getCertificates');
		return $resp->response->certificates;		
	}
	function getTemplates(){
		$resp=$template->executeAPICall('getTemplates');
		return $resp->response->templates;		
	}
	
	function getCertificate($id){
		$resp=$template->executeAPICall('getCertificate','id='.$id);
		return $resp->response->certificate;		
	}	

	function addCertificate($courseid,$email,$name,$date,$code='',$programshort='',$hours='',$enddate='',$grade='',$teacher='',$courseidtype=''){
		if($courseidtype=='') $courseidtype=$template->courseidtype;
		$options='email='.urlencode($email).
			'&code='.urlencode($code).
			'&name='.urlencode($name).
			'&date='.urlencode($date).
			'&program='.urlencode($program).
			'&programshort='.urlencode($programshort).
			'&coursehours='.urlencode($hours).
			'&enddate='.urlencode($enddate).
			'&grade='.urlencode($grade).
			'&teacher='.urlencode($teacher).
			'&templateid='.urlencode($template->templateid).
			'&courseid='.urlencode($courseid).
			'&emailuser='.($template->emailuser?'y':'n').
			'&courseidtype='.$courseidtype;
		$resp=$template->executeAPICall('addCertificate',$options);

		if($resp->status=='ok') return $resp->response->certificate;
		return false;
	}
	
	function removeCertificate($certificateid){
		$options='id='.urlencode($certificateid);
		$resp=$template->executeAPICall('deletecertificate',$options);
		if($resp->status=='ok') return true;
		return false;
	}
	function getPrintCertificateLink($certificateid){
		$options='id='.urlencode($certificateid);
		$resp=$template->executeAPICall('getcertificate',$options);
		if($resp->status=='ok') $resp->response->certificate->printlink;
		return '';
	}
}
?>