Quiz API

API change history

List of APIs related to Quiz

Submit session

Submit session, used when student submit/finish taking the assessment. It can also be used by lecturer when student forgot to submit his/her session. A submitted session is considered as 'Completed'.

Try it

Request

Request URL

Request parameters

  • string

    Format - uuid. Session Id

  • (optional)
    integer

    Format - int32. count down timer for logging

  • (optional)
    boolean

    whether user click the submit button to submit

Request headers

  • string
    Subscription key which provides access to this API. Found in your Profile.

Request body

Responses

200 OK

Submitted/Completed session

Representations

{
  "description": "user attempted session on the assessment",
  "type": "object",
  "properties": {
    "id": {
      "format": "uuid",
      "description": "attempt Id",
      "type": "string"
    },
    "parentId": {
      "format": "uuid",
      "description": "assessment Id",
      "type": "string"
    },
    "creatorId": {
      "format": "uuid",
      "description": "Id of the user who made on this attempt",
      "type": "string"
    },
    "startDate": {
      "format": "date-time",
      "description": "the time when user start taking the assessment",
      "type": "string"
    },
    "isCompleted": {
      "description": "whether the user has ended the session",
      "type": "boolean",
      "readOnly": true
    },
    "completedDate": {
      "format": "date-time",
      "description": "the time when user finish taking the assessment",
      "type": "string"
    },
    "duration": {
      "format": "double",
      "description": "time taken in seconds, used for time-limit assessment",
      "type": "number"
    },
    "timeLeft": {
      "format": "double",
      "description": "time left in seconds to take the quiz, used for time-limit assessment",
      "type": "number"
    },
    "score": {
      "format": "double",
      "description": "score summed from all questions for this session",
      "type": "number"
    },
    "moderation": {
      "format": "double",
      "description": "moderation of scores set by lecturer",
      "type": "number"
    },
    "totalScore": {
      "format": "double",
      "description": "total score  (score + moderation)",
      "type": "number",
      "readOnly": true
    },
    "userId": {
      "description": "login id of the user",
      "type": "string"
    },
    "userName": {
      "description": "name of the user",
      "type": "string"
    },
    "userMatrixNo": {
      "description": "matric number of the user",
      "type": "string"
    },
    "userEmail": {
      "description": "email of the user",
      "type": "string"
    },
    "remark": {
      "description": "overall comment made by lecturer",
      "type": "string"
    },
    "responses": {
      "description": "answers user made on this attempt",
      "type": "array",
      "items": {
        "description": "answers user made on a assessment question",
        "type": "object",
        "properties": {
          "id": {
            "format": "uuid",
            "description": "response id",
            "type": "string"
          },
          "questionID": {
            "format": "uuid",
            "description": "Question ID",
            "type": "string"
          },
          "createdDate": {
            "format": "date-time",
            "description": "when the answer is made last time",
            "type": "string"
          },
          "creatorID": {
            "format": "uuid",
            "description": "Id of the user who made the answer",
            "type": "string"
          },
          "userId": {
            "description": "login id of the user who made the answer",
            "type": "string"
          },
          "userName": {
            "description": "Name of the user who made the answer",
            "type": "string"
          },
          "userMatrixNo": {
            "description": "matrix number of the user who made the answer",
            "type": "string"
          },
          "mark": {
            "format": "double",
            "description": "marks calculated by system or set by lecturer",
            "type": "number"
          },
          "remark": {
            "description": "comment made on this answer by lecturer",
            "type": "string"
          },
          "scoredBy": {
            "format": "uuid",
            "description": "Id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserName": {
            "description": "Name of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserId": {
            "description": "login id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "options": {
            "description": "Order value of selected options for Choice questions: eg [3, 1], starting number of order is 1.",
            "type": "array",
            "items": {
              "format": "int32",
              "type": "integer"
            }
          },
          "text": {
            "description": "input text made for essay questions",
            "type": "string"
          },
          "tof": {
            "description": "answer for TOF question",
            "type": "boolean"
          },
          "lstAnswer": {
            "description": "answer for fill in the blank question or matched values for matching question",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rational": {
            "description": "rational content for the answer, userd for normal assessment",
            "type": "string"
          },
          "skipQuestion": {
            "description": "whether user has skipped this question, used for question with negative marking",
            "type": "boolean"
          }
        }
      }
    },
    "iteration": {
      "format": "int32",
      "description": "Iteration used for adaptive quiz",
      "type": "integer"
    }
  }
}
{
  "id": "string",
  "parentId": "string",
  "creatorId": "string",
  "startDate": "string",
  "isCompleted": true,
  "completedDate": "string",
  "duration": 0.0,
  "timeLeft": 0.0,
  "score": 0.0,
  "moderation": 0.0,
  "totalScore": 0.0,
  "userId": "string",
  "userName": "string",
  "userMatrixNo": "string",
  "userEmail": "string",
  "remark": "string",
  "responses": [
    {
      "id": "string",
      "questionID": "string",
      "createdDate": "string",
      "creatorID": "string",
      "userId": "string",
      "userName": "string",
      "userMatrixNo": "string",
      "mark": 0.0,
      "remark": "string",
      "scoredBy": "string",
      "markerUserName": "string",
      "markerUserId": "string",
      "options": [
        0
      ],
      "text": "string",
      "tof": true,
      "lstAnswer": [
        "string"
      ],
      "rational": "string",
      "skipQuestion": true
    }
  ],
  "iteration": 0
}
{
  "description": "user attempted session on the assessment",
  "type": "object",
  "properties": {
    "id": {
      "format": "uuid",
      "description": "attempt Id",
      "type": "string"
    },
    "parentId": {
      "format": "uuid",
      "description": "assessment Id",
      "type": "string"
    },
    "creatorId": {
      "format": "uuid",
      "description": "Id of the user who made on this attempt",
      "type": "string"
    },
    "startDate": {
      "format": "date-time",
      "description": "the time when user start taking the assessment",
      "type": "string"
    },
    "isCompleted": {
      "description": "whether the user has ended the session",
      "type": "boolean",
      "readOnly": true
    },
    "completedDate": {
      "format": "date-time",
      "description": "the time when user finish taking the assessment",
      "type": "string"
    },
    "duration": {
      "format": "double",
      "description": "time taken in seconds, used for time-limit assessment",
      "type": "number"
    },
    "timeLeft": {
      "format": "double",
      "description": "time left in seconds to take the quiz, used for time-limit assessment",
      "type": "number"
    },
    "score": {
      "format": "double",
      "description": "score summed from all questions for this session",
      "type": "number"
    },
    "moderation": {
      "format": "double",
      "description": "moderation of scores set by lecturer",
      "type": "number"
    },
    "totalScore": {
      "format": "double",
      "description": "total score  (score + moderation)",
      "type": "number",
      "readOnly": true
    },
    "userId": {
      "description": "login id of the user",
      "type": "string"
    },
    "userName": {
      "description": "name of the user",
      "type": "string"
    },
    "userMatrixNo": {
      "description": "matric number of the user",
      "type": "string"
    },
    "userEmail": {
      "description": "email of the user",
      "type": "string"
    },
    "remark": {
      "description": "overall comment made by lecturer",
      "type": "string"
    },
    "responses": {
      "description": "answers user made on this attempt",
      "type": "array",
      "items": {
        "description": "answers user made on a assessment question",
        "type": "object",
        "properties": {
          "id": {
            "format": "uuid",
            "description": "response id",
            "type": "string"
          },
          "questionID": {
            "format": "uuid",
            "description": "Question ID",
            "type": "string"
          },
          "createdDate": {
            "format": "date-time",
            "description": "when the answer is made last time",
            "type": "string"
          },
          "creatorID": {
            "format": "uuid",
            "description": "Id of the user who made the answer",
            "type": "string"
          },
          "userId": {
            "description": "login id of the user who made the answer",
            "type": "string"
          },
          "userName": {
            "description": "Name of the user who made the answer",
            "type": "string"
          },
          "userMatrixNo": {
            "description": "matrix number of the user who made the answer",
            "type": "string"
          },
          "mark": {
            "format": "double",
            "description": "marks calculated by system or set by lecturer",
            "type": "number"
          },
          "remark": {
            "description": "comment made on this answer by lecturer",
            "type": "string"
          },
          "scoredBy": {
            "format": "uuid",
            "description": "Id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserName": {
            "description": "Name of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserId": {
            "description": "login id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "options": {
            "description": "Order value of selected options for Choice questions: eg [3, 1], starting number of order is 1.",
            "type": "array",
            "items": {
              "format": "int32",
              "type": "integer"
            }
          },
          "text": {
            "description": "input text made for essay questions",
            "type": "string"
          },
          "tof": {
            "description": "answer for TOF question",
            "type": "boolean"
          },
          "lstAnswer": {
            "description": "answer for fill in the blank question or matched values for matching question",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rational": {
            "description": "rational content for the answer, userd for normal assessment",
            "type": "string"
          },
          "skipQuestion": {
            "description": "whether user has skipped this question, used for question with negative marking",
            "type": "boolean"
          }
        }
      }
    },
    "iteration": {
      "format": "int32",
      "description": "Iteration used for adaptive quiz",
      "type": "integer"
    }
  }
}
{
  "id": "string",
  "parentId": "string",
  "creatorId": "string",
  "startDate": "string",
  "isCompleted": true,
  "completedDate": "string",
  "duration": 0.0,
  "timeLeft": 0.0,
  "score": 0.0,
  "moderation": 0.0,
  "totalScore": 0.0,
  "userId": "string",
  "userName": "string",
  "userMatrixNo": "string",
  "userEmail": "string",
  "remark": "string",
  "responses": [
    {
      "id": "string",
      "questionID": "string",
      "createdDate": "string",
      "creatorID": "string",
      "userId": "string",
      "userName": "string",
      "userMatrixNo": "string",
      "mark": 0.0,
      "remark": "string",
      "scoredBy": "string",
      "markerUserName": "string",
      "markerUserId": "string",
      "options": [
        0
      ],
      "text": "string",
      "tof": true,
      "lstAnswer": [
        "string"
      ],
      "rational": "string",
      "skipQuestion": true
    }
  ],
  "iteration": 0
}
{
  "description": "user attempted session on the assessment",
  "type": "object",
  "properties": {
    "id": {
      "format": "uuid",
      "description": "attempt Id",
      "type": "string"
    },
    "parentId": {
      "format": "uuid",
      "description": "assessment Id",
      "type": "string"
    },
    "creatorId": {
      "format": "uuid",
      "description": "Id of the user who made on this attempt",
      "type": "string"
    },
    "startDate": {
      "format": "date-time",
      "description": "the time when user start taking the assessment",
      "type": "string"
    },
    "isCompleted": {
      "description": "whether the user has ended the session",
      "type": "boolean",
      "readOnly": true
    },
    "completedDate": {
      "format": "date-time",
      "description": "the time when user finish taking the assessment",
      "type": "string"
    },
    "duration": {
      "format": "double",
      "description": "time taken in seconds, used for time-limit assessment",
      "type": "number"
    },
    "timeLeft": {
      "format": "double",
      "description": "time left in seconds to take the quiz, used for time-limit assessment",
      "type": "number"
    },
    "score": {
      "format": "double",
      "description": "score summed from all questions for this session",
      "type": "number"
    },
    "moderation": {
      "format": "double",
      "description": "moderation of scores set by lecturer",
      "type": "number"
    },
    "totalScore": {
      "format": "double",
      "description": "total score  (score + moderation)",
      "type": "number",
      "readOnly": true
    },
    "userId": {
      "description": "login id of the user",
      "type": "string"
    },
    "userName": {
      "description": "name of the user",
      "type": "string"
    },
    "userMatrixNo": {
      "description": "matric number of the user",
      "type": "string"
    },
    "userEmail": {
      "description": "email of the user",
      "type": "string"
    },
    "remark": {
      "description": "overall comment made by lecturer",
      "type": "string"
    },
    "responses": {
      "description": "answers user made on this attempt",
      "type": "array",
      "items": {
        "description": "answers user made on a assessment question",
        "type": "object",
        "properties": {
          "id": {
            "format": "uuid",
            "description": "response id",
            "type": "string"
          },
          "questionID": {
            "format": "uuid",
            "description": "Question ID",
            "type": "string"
          },
          "createdDate": {
            "format": "date-time",
            "description": "when the answer is made last time",
            "type": "string"
          },
          "creatorID": {
            "format": "uuid",
            "description": "Id of the user who made the answer",
            "type": "string"
          },
          "userId": {
            "description": "login id of the user who made the answer",
            "type": "string"
          },
          "userName": {
            "description": "Name of the user who made the answer",
            "type": "string"
          },
          "userMatrixNo": {
            "description": "matrix number of the user who made the answer",
            "type": "string"
          },
          "mark": {
            "format": "double",
            "description": "marks calculated by system or set by lecturer",
            "type": "number"
          },
          "remark": {
            "description": "comment made on this answer by lecturer",
            "type": "string"
          },
          "scoredBy": {
            "format": "uuid",
            "description": "Id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserName": {
            "description": "Name of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "markerUserId": {
            "description": "login id of the user who marked the response (Mark and Comment)",
            "type": "string"
          },
          "options": {
            "description": "Order value of selected options for Choice questions: eg [3, 1], starting number of order is 1.",
            "type": "array",
            "items": {
              "format": "int32",
              "type": "integer"
            }
          },
          "text": {
            "description": "input text made for essay questions",
            "type": "string"
          },
          "tof": {
            "description": "answer for TOF question",
            "type": "boolean"
          },
          "lstAnswer": {
            "description": "answer for fill in the blank question or matched values for matching question",
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "rational": {
            "description": "rational content for the answer, userd for normal assessment",
            "type": "string"
          },
          "skipQuestion": {
            "description": "whether user has skipped this question, used for question with negative marking",
            "type": "boolean"
          }
        }
      }
    },
    "iteration": {
      "format": "int32",
      "description": "Iteration used for adaptive quiz",
      "type": "integer"
    }
  }
}

400 Bad Request

Bad Request

Representations

{
  "type": "string"
}
string
{
  "type": "string"
}
string
{
  "type": "string"
}

403 Forbidden

Login user not authorized to perform this action.

Representations

{
  "type": "string"
}
string
{
  "type": "string"
}
string
{
  "type": "string"
}

404 Not Found

Not Found

Representations

{
  "type": "string"
}
string
{
  "type": "string"
}
string
{
  "type": "string"
}

500 Internal Server Error

Server Error

Representations

{
  "type": "string"
}
string
{
  "type": "string"
}
string
{
  "type": "string"
}

Code samples

@ECHO OFF

curl -v -X PUT "https://luminus.azure-api.net/assessment/session/{id}/submit?CountDownTimer={integer}&ManualSubmission={boolean}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}" 
using System;
using System.Net.Http.Headers;
using System.Text;
using System.Net.Http;
using System.Web;

namespace CSHttpClientSample
{
    static class Program
    {
        static void Main()
        {
            MakeRequest();
            Console.WriteLine("Hit ENTER to exit...");
            Console.ReadLine();
        }
        
        static async void MakeRequest()
        {
            var client = new HttpClient();
            var queryString = HttpUtility.ParseQueryString(string.Empty);

            // Request headers
            client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", "{subscription key}");

            // Request parameters
            queryString["CountDownTimer"] = "{integer}";
            queryString["ManualSubmission"] = "{boolean}";
            var uri = "https://luminus.azure-api.net/assessment/session/{id}/submit?" + queryString;

            HttpResponseMessage response;

            // Request body
            byte[] byteData = Encoding.UTF8.GetBytes("{body}");

            using (var content = new ByteArrayContent(byteData))
            {
                content.Headers.ContentType = new MediaTypeHeaderValue("< your content type, i.e. application/json >");
                response = await client.PutAsync(uri, content);
            }
        }
    }
}	
// // This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
import java.net.URI;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;

public class JavaSample 
{
    public static void main(String[] args) 
    {
        HttpClient httpclient = HttpClients.createDefault();

        try
        {
            URIBuilder builder = new URIBuilder("https://luminus.azure-api.net/assessment/session/{id}/submit");

            builder.setParameter("CountDownTimer", "{integer}");
            builder.setParameter("ManualSubmission", "{boolean}");

            URI uri = builder.build();
            HttpPut request = new HttpPut(uri);
            request.setHeader("Ocp-Apim-Subscription-Key", "{subscription key}");


            // Request body
            StringEntity reqEntity = new StringEntity("{body}");
            request.setEntity(reqEntity);

            HttpResponse response = httpclient.execute(request);
            HttpEntity entity = response.getEntity();

            if (entity != null) 
            {
                System.out.println(EntityUtils.toString(entity));
            }
        }
        catch (Exception e)
        {
            System.out.println(e.getMessage());
        }
    }
}

<!DOCTYPE html>
<html>
<head>
    <title>JSSample</title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
</head>
<body>

<script type="text/javascript">
    $(function() {
        var params = {
            // Request parameters
            "CountDownTimer": "{integer}",
            "ManualSubmission": "{boolean}",
        };
      
        $.ajax({
            url: "https://luminus.azure-api.net/assessment/session/{id}/submit?" + $.param(params),
            beforeSend: function(xhrObj){
                // Request headers
                xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key","{subscription key}");
            },
            type: "PUT",
            // Request body
            data: "{body}",
        })
        .done(function(data) {
            alert("success");
        })
        .fail(function() {
            alert("error");
        });
    });
</script>
</body>
</html>
#import <Foundation/Foundation.h>

int main(int argc, const char * argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    
    NSString* path = @"https://luminus.azure-api.net/assessment/session/{id}/submit";
    NSArray* array = @[
                         // Request parameters
                         @"entities=true",
                         @"CountDownTimer={integer}",
                         @"ManualSubmission={boolean}",
                      ];
    
    NSString* string = [array componentsJoinedByString:@"&"];
    path = [path stringByAppendingFormat:@"?%@", string];

    NSLog(@"%@", path);

    NSMutableURLRequest* _request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:path]];
    [_request setHTTPMethod:@"PUT"];
    // Request headers
    [_request setValue:@"{subscription key}" forHTTPHeaderField:@"Ocp-Apim-Subscription-Key"];
    // Request body
    [_request setHTTPBody:[@"{body}" dataUsingEncoding:NSUTF8StringEncoding]];
    
    NSURLResponse *response = nil;
    NSError *error = nil;
    NSData* _connectionData = [NSURLConnection sendSynchronousRequest:_request returningResponse:&response error:&error];

    if (nil != error)
    {
        NSLog(@"Error: %@", error);
    }
    else
    {
        NSError* error = nil;
        NSMutableDictionary* json = nil;
        NSString* dataString = [[NSString alloc] initWithData:_connectionData encoding:NSUTF8StringEncoding];
        NSLog(@"%@", dataString);
        
        if (nil != _connectionData)
        {
            json = [NSJSONSerialization JSONObjectWithData:_connectionData options:NSJSONReadingMutableContainers error:&error];
        }
        
        if (error || !json)
        {
            NSLog(@"Could not parse loaded json with error:%@", error);
        }
        
        NSLog(@"%@", json);
        _connectionData = nil;
    }
    
    [pool drain];

    return 0;
}
<?php
// This sample uses the Apache HTTP client from HTTP Components (http://hc.apache.org/httpcomponents-client-ga/)
require_once 'HTTP/Request2.php';

$request = new Http_Request2('https://luminus.azure-api.net/assessment/session/{id}/submit');
$url = $request->getUrl();

$headers = array(
    // Request headers
    'Ocp-Apim-Subscription-Key' => '{subscription key}',
);

$request->setHeader($headers);

$parameters = array(
    // Request parameters
    'CountDownTimer' => '{integer}',
    'ManualSubmission' => '{boolean}',
);

$url->setQueryVariables($parameters);

$request->setMethod(HTTP_Request2::METHOD_PUT);

// Request body
$request->setBody("{body}");

try
{
    $response = $request->send();
    echo $response->getBody();
}
catch (HttpException $ex)
{
    echo $ex;
}

?>
########### Python 2.7 #############
import httplib, urllib, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.urlencode({
    # Request parameters
    'CountDownTimer': '{integer}',
    'ManualSubmission': '{boolean}',
})

try:
    conn = httplib.HTTPSConnection('luminus.azure-api.net')
    conn.request("PUT", "/assessment/session/{id}/submit?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################

########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64

headers = {
    # Request headers
    'Ocp-Apim-Subscription-Key': '{subscription key}',
}

params = urllib.parse.urlencode({
    # Request parameters
    'CountDownTimer': '{integer}',
    'ManualSubmission': '{boolean}',
})

try:
    conn = http.client.HTTPSConnection('luminus.azure-api.net')
    conn.request("PUT", "/assessment/session/{id}/submit?%s" % params, "{body}", headers)
    response = conn.getresponse()
    data = response.read()
    print(data)
    conn.close()
except Exception as e:
    print("[Errno {0}] {1}".format(e.errno, e.strerror))

####################################
require 'net/http'

uri = URI('https://luminus.azure-api.net/assessment/session/{id}/submit')

query = URI.encode_www_form({
    # Request parameters
    'CountDownTimer' => '{integer}',
    'ManualSubmission' => '{boolean}'
})
if query.length > 0
  if uri.query && uri.query.length > 0
    uri.query += '&' + query
  else
    uri.query = query
  end
end

request = Net::HTTP::Put.new(uri.request_uri)
# Request headers
request['Ocp-Apim-Subscription-Key'] = '{subscription key}'
# Request body
request.body = "{body}"

response = Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|
    http.request(request)
end

puts response.body