API - Create ExamTestInstance

This API is used to create exam test instance.

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



Parameter 2 - UserName

Username of the site admin


Parameter 3 - Request Parameters

Name Value  


xml true  
subscriptionId Event Subscription Id  


Test Id whose Instance needs to be added in exam event for this user. (Note: Test must be already present in Event's  EventItem)  


Test Taken start date. Start date of the learner, represented as epoch time in milliseconds - number of milliseconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds

(Dummy End date is default added as  start date + 60 seconds



TestInstance status for this user. This is boolean value to be passed as 'true' / 'false'


score Float number - total points, optional  


Float number  - score in percentage terms (this can be only between 0-100). If both score and scorePercentage is passed, then percentage will take precedence.  



1. Response on successfully adding user to group

HTTP Response Code = HttpServletResponse.SC_OK

Response XML

<response code="0">


2. Response for unauthorized access

HTTP Response Code = HttpServletResponse.SC_UNAUTHORIZED

Response XML

<response code="-1">
             <value><![CDATA[You are not allowed to perform this action.]]></value>



Code Snippet

/* Check API Call for detail */


Map<String, String> parameters = new HashMap<String, String>();


String result = connection.invokeApi("enrollmentService.do", "adminusername", parameters);


private void populateMapForCreateExam(Map<String, String> parameters) {
    parameters.put("dispatch", "createExamTestInstance");
    parameters.put("xml", String.valueOf(true));
    parameters.put("subscriptionId", "xxxx-xxxx-xxxx-xxxx");
    parameters.put("testId", "xxxx-xxxx-xxxx-xxxx");
    parameters.put("startDate", "1495163497116"); //Set exam instance  dates of learners

      parameters.put("passed", String.valueOf(true));