Seek Help - REST API


Windows 10
WAMP Server

Install By
Web Installer

I am new to Tao. I am trying to access test results using REST API.

I have created a test.php page and put it in a separate folder and follow this guide

These are the parameters used.
$testtakerUri = urlencode('http://localhost/tao330/tao330.rdf#i1572615803913774');
$deliveryUri = urlencode('http://localhost/tao330/tao330.rdf#i1572616018534077');
$resultId = urlencode('http://localhost/tao330/tao330.rdf#i1572616148409589');

PHP Code Start
// Entry point of QTI results api
$apiUrl = 'http://localhost/tests/tao/tao330/taoResultServer/QtiRestResults';

// Parameters required to proceed request, take care to escape uri variable
$testtakerUri = urlencode('http://localhost/tao330/tao330.rdf#i1572615803913774');
$deliveryUri = urlencode('http://localhost/tao330/tao330.rdf#i1572616018534077');

// Case A: Result id for delivery execution
$resultId = urlencode('http://localhost/tao330/tao330.rdf#i1572616148409589');

// Case B: Result id for LTI delivery.
// $resultId = 'bf29e71611330b19a723e2bed6f47255';

// Initialize the cURL request to get the latest results for a given test-taker and delivery
$process = curl_init($apiUrl . '/getLatest?testtaker=' . $testtakerUri . '&delivery=' . $deliveryUri);

// OR Initialize the cURL request to get a specific result (by default the result identifier is the same as the delivery execution identifier)
$process = curl_init($apiUrl . '/getQtiResultXml?delivery=' . $deliveryUri . '&result=' . $resultId);

// Call api with HTTP GET method
curl_setopt($process, CURLOPT_HTTPGET, 1);

// Choose your output, QTI data is based on XML
curl_setopt($process, CURLOPT_HTTPHEADER, array("Accept: application/xml"));

// Get response as a string instead of output it directly
curl_setopt($process, CURLOPT_RETURNTRANSFER , true);

// Set up your TAO credential
curl_setopt($process, CURLOPT_USERPWD, "taomin:bigindia2019");

// Proceed the curl request
$data = curl_exec($process);

// REST communicate through HTTP code, take care of it
$httpCode = curl_getinfo($process, CURLINFO_HTTP_CODE);

// Close process handling

echo json_encode($data);

PHP Code End

"\n\n false<\/success>\n 0<\/errorCode>\n Persistence Configuration for persistence keyValueResult not found<\/errorMsg>\n 3.3.0-RC02<\/version>\n<\/root>\n"

How do I overcome the issue? Please help me. I am in a hurry.

I am waiting for the reply.

Regards & Thanks,

Sign In or Register to comment.

We use cookies on our website to support technical features that enhance your user experience. Cookie Policy Privacy Policy