Api - Test Attempts (Test Instances) List

Test Attempts (Test Instances) List

This API is used to obtain the list of test instances from a microsite.

 

API Details

Signature of API call

connection.invokeApi(String uri, String realUserName, Map<String, String> requestParameters);

See details about invoking API in general

 

Parameter 1 - URI

testdetail.do

 

Parameter 2 - UserName

Username of any site administrator or group administrator

 

Parameter 3 - Request Parameters

Name Value
dispatch getRecentlyTaken
userSearchStr username, firstname, lastname, email pattern (optional)
testId specific test id (optional)
quizOrSurvey quiz | survey (optional)
fromDateLong from date in millis (optional)
toDateLong to date in millis (optional)
userId specific user's id (optional)
xml true
pageSize Optional - default value is 10
currPage

Optional - default value is 0.

 

to fetch multiple pages, this api needs to be called multiple times, with value for currPage parameter 0, 1, 2 .... upto the total number of items available from the api. 

 

First call to the API carries a response XML which contains information about the total number of items available.

 

Response

Response on successfully getting the test instance list

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<testAttempts numItems="30" currPage="0" pageSize="10">

<ranks>

<rank>
<testId>15bbcf7a-4deb-11e1-8a65-0030489d05ee</testId>
<testName>
<![CDATA[ Sales Training Quiz ]]>
</testName>
<survey>false</survey>
<position>5</position>
<score>0.0</score>
<date>1332885263000</date> 
<timeTakenMin>0</timeTakenMin>
<testInstanceId>674493fe-7857-11e1-b0d1-0030489d05ee</testInstanceId>
<userId>5d4ba83a-4c2a-102b-a6f6-00301b4433e5</userId>
<firstName>
<![CDATA[ John ]]>
</firstName>
<lastName>
<![CDATA[ Doe ]]>
</lastName>
<picture id="91f78610-4add-11e1-8a65-0030499005ee" name="IMG_2113.JPG"/>
<noOfCorrect>0</noOfCorrect>
<noOfIncorrect>4</noOfIncorrect>
<noOfUnknown>0</noOfUnknown>
<pass>false</pass>
</rank>
<rank>
...
</rank>
...

 

</ranks>

</testAttempts>

Code Snippet

 

    /* Check API Call for detail generic code */
    Map<String, String> parameters = new HashMap<String, String>();
    parameters.put("dispatch", "getRecentlyTaken");
    parameters.put("xml", String.valueOf(true));
    /* add the currPage parameter to fetch the data for second page onwards */
    String retStr = connection.invokeApi("testdetail.do", "charles", parameters);
    System.out.println(retStr);

 


Rating: