Forum

TAO 3.2 - Create Test Taker from API - Is there any API that still work?

edited September 10 in General

I'm refering to this guide. It seem to be outdated.

https://hub.taotesting.com/articles/rest-services-layer-tutorial

Then I found this reference:
https://github.com/oat-sa/extension-tao-testtaker/blob/master/doc/swagger.json

I'm not really understand how to use that and test on postman. Is there any guide how to use API to create new Test Taker and assign it to a group? Existing discussion seem to not reach any conclusion.

Please advice. Thank You.

Comments

  • edited September 10

    This is the code I'm using right now.

    `
    $process = curl_init("http://myhost/apps/reqt/taoTestTaker/api/testTakers");
    curl_setopt($process, CURLOPT_POST, 1);

    //needed using curl on apache
    curl_setopt($process, CURLOPT_POSTFIELDS, "");
    
    curl_setopt($process,CURLOPT_HTTPHEADER, array( 
        "Accept: application/x-www-form-urlencoded", 
        "label: Patrick Plichart", 
        "lastname: Plichart", 
        "firstname: Plichart", 
        "login: pplichart", 
        "password: dummy" 
    ));
    
    //set your credentials 
    curl_setopt($process, CURLOPT_USERPWD, "mylogin:mypassword");
    
    //return the transfer as a string of the return value of curl_exec() instead of outputting it out directly. 
    curl_setopt($process, CURLOPT_RETURNTRANSFER, 1);
    
    $returnedData = curl_exec($process);
    
    //allways check the http code returned 
    $httpCode = curl_getinfo($process, CURLINFO_HTTP_CODE);
    
    $data = json_decode($returnedData, true);
    
    curl_close($process);
    
    echo $httpCode;
    

    `

    Return result:
    406

    Why did I get this 406 which mean "Not Acceptable The request can not be accepted by the server."

    Please advice.

  • "Accept: application/x-www-form-urlencoded" is probably incorrect, try changing it to
    "Accept: application/json"

  • already tried that as well. still not working.

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

×