Forum

REST API Request URL

edited October 25 in Developers

Hello.

Environment
WAMP Server
Windows 10

Problem
1. I have created an item in my local tao manual installation. It has a Resource Identifier http://localhost/tests/tao/tao330/tao330.rdf#i1572001791942656.
2. I wish to use REST API as given in the page https://hub.taotesting.com/restapis/tao-restful-api-combined/tao-restful-api.
3. I want to use the API /taoQtiItem/RestQtiItem/export/.
It needs an Item id. I have given item id's Resource Identifier.
4. Click on 'Try it out!' button.
5. In the result I have received the below information.
Request URL
https://hub.taotesting.com/taoQtiItem/RestQtiItem/export/?id=http://localhost/tests/tao/tao330/tao330.rdf#i1572001791942656
Response Body
In the tag it is written 'Error 404 - Page not found'.
Response Code
404

Seek Help
Please let me know where it is wrong.
What exactly am I need to give in the parameter list?
How do I practice it in a normal PHP page?

I am waiting for the reply.

Regards & Thanks.

Comments

  • The try-it feature is not currently running, I have requested an update on the issue.

  • How do I use the REST API?
    Is there any documentation / tutorials / guide?

  • edited November 3

    I am using this online URL https://hub.taotesting.com/restapis/tao-outcome/qti-result-rest-api to get the result.

    In my WAMP server, under tao3.3 admin panel, I have created Test-taker and Delivery.
    This live online API panel needs two parameters value - testtaker and delivery.

    Please help me by clearing below doubts and finding the requirements.
    What does it mean by testtaker value and delivery value?
    Where do I find these values?
    Can I use my local installer's value to get the result?
    Is it possible to use this in simple PHP page?

    I am waiting for the reply and help.

  • edited November 5

    Hello.

    I am trying below code in WAMP Server to retrieve test result. But it is giving the error.

    Code
    <?php // Entry point of QTI results api $apiUrl = 'http://localhost/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 curl_close($process); echo json_encode($data); ?>

    Error
    "\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"

    Question
    What is this 3.3.0-RC02? Am I need to install it? How do I install it, if needed?
    Extension generis is not upgrading to version 12.5.0. As a result extension taoLti is not installing. Is taoLti required to retrieve result using REST API?

    Please show me some light to use REST API.

    I am waiting for the reply.

    Best Regards,
    Amit

  • Hi

    You seem to have installed the deprecated extension "taoAltResultStorage" which requires a working keyvalue store on top of the SQL database (support for dynamoDb and ElasticCache exist). This extension should not be installed.

    If you do not have any critical data in your system yet, I would recommend to restart a fresh clean install with the Community Edition extensions only.

    Kind regards,
    Joel

  • Hi Joel.

    Many thanks for the reply.

    Done
    1. As suggested by you, I have done a fresh installation with Community edition.
    2. There is no installed extension 'taoAltResultStorage'.
    3. Also I do not install / update any extension yet.
    4. Go through entire post and help me to find the solution. I wish to retrieve Tests and Results and show it to separate PHP files. Can I do it?

    My Environment
    Windows 10
    WAMP Server

    Problem
    1. I have created the below PHP script and put it inside folder http://localhost/tao/test.php.
    2. But getting the error which is pasted below the PHP script.

    1. I am getting the below information from respective section of admin panel.
    2. Login to admin panel and create the respective resource and get the info from Resource Identofier.
    3. Please let me know if I am wrong anywhere regarding resource collection and other.

    // Test-takers > Create new test-taker > Resource Identifier.
    $testtakerUri = urlencode('http://localhost/tao33/tao33.rdf#i1573044917138210');

    // Deliveries > Create new delivery > Resource Identifier.
    $deliveryUri = urlencode('http://localhost/tao33/tao33.rdf#i1573045029240315');

    // Tools > Results monitoring > Delivery Execution.
    $resultId = urlencode('http://localhost/tao33/tao33.rdf#i1573045158910131');

    PHP Script
    // Entry point of QTI results api
    $apiUrl = 'http://localhost/tao33/taoResultServer/QtiRestResults';

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

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

    // 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:good123");

    // 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
    curl_close($process);

    echo json_encode($data);

    Error
    "\n\n \n \n \n <\/value>\n <\/outcomeVariable>\n <\/testResult>\n \n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n <\/itemResult>\n \n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n <\/itemResult>\n \n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n <\/itemResult>\n \n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n <\/itemResult>\n \n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n <\/value>\n <\/outcomeVariable>\n \n \n <\/value>\n <\/candidateResponse>\n <\/responseVariable>\n <\/itemResult>\n<\/assessmentResult>\n"

    Please help me to resolve the issue earliest.

    Regards & Thanks,
    Amit

  • Hello.

    Anyone please help me to use the REST API.
    At least let me know if there is any chance to use it from local server, say WAMP server.
    I am in a hurry and urgently looking for support.

    Regards & Thanks,
    Amit

  • The information you have listed as an error is actually the XML response so it is correct.

  • Amy, please help me to figure it out.

    I do not understand the data arrangement. What am I getting actually? I wish to retieve the result of the test.

    Please help.

  • Hi Amit did you get solution to use Tao RESTFUL API features?

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

×