17. Get Result of Candidate in Schedule

17. Get Result of Candidate in Schedule

Definition

This  GET  API is used to fetch the status or result of a particular candidate in a schedule/ test link (such as candidate registration fields, test status, proctoring details and test results if the test is finished).
      *PDF documentation reference - Section 6.3 Fetch status of a test for a candidate

where, access-key is the unique key of the schedule/ test link from which you want to fetch the status or result of a particular candidate,
and, candidate-email-id is the unique email Id of the candidate added to a schedule/ test link for which you want to fetch the status or result.

You can get an access-key from the test link settings in your dashboard (alphanumeric key at the end of the 'Link to Share') or via API by using Create Schedule API , Get All Schedules in Assessment API or Get All Schedules in Account API.

Query Parameters

In our REST APIs, Query Parameters have to be URL encoded as the data is being transmitted in the request URL. This is especially important for the  asgn  parameter and any parameters with JSON as they always contain characters that need to be URL encoded. Since  ak  and  ts   parameters don't contain any characters that need to be URL encoded, URL encoding of these parameters can be skipped.

Mandatory parameters


Query Parameter


Description

ak

This is your Public-API-Key, which Mettl uses to identify your account.

ts

This is the current UNIX or Epoch Timestamp (the number of seconds between 1970-01-01 00:00:00 and current UTC Time). Any current generated Timestamp will be valid for 24 hours only.

asgn

This is a unique Signature which has to be generated  for each API request.

The Signature is generated by creating a String-to-Sign and hashing it with your Private-API-Key using  the HMAC-SHA256 (for version v2 and v3) or HMAC-SHA1 (for v1) hashing algorithm with Base-64 and URL encoding.

Read more about the above Signature Generation Process in  API Authentication and Signature Generation.


 GET  request syntax with mandatory parameters:
https://api.mettl.com/v2/schedules/{access-key}/candidates/{candidate-email-id}?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}      

Optional parameters


Query Parameter


Description

ir

Enables sending recommendation in the results wherever the same is configured for an assessment.

You can input a JSON in the format {"recommendation":true} to enable this recommendation which is disabled by default.

rs

Enables sending response style in the results wherever the same is configured for an assessment.

You can input either true or false, with the default value being false.

qr

Enables sending responses for essay questions where manual grading is required.

You can input either true or false, with the default value being false.


 GET  request syntax with all parameters:
https://api.mettl.com/v2/schedules/{access-key}/candidates/{candidate-email-id}?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}&ir={Recommendation-JSON}&rs={Boolean}&qr={Boolean}

Examples

1) Request with only mandatory query parameters
Request without Signature
a.  GET  request URL, with queries  ak  and  ts  but without  asgn  (Signature)
https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200

b. Creating a String-to-Sign, calculated with Method + Endpoint + Values of query parametersin new lines and in ascending order of the parameter name (i.e., the new line characters "\n" followed by values of  ak  and  ts  in order, for this example)
String-to-Sign = "GET" +  "https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "1635976200"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
1635976200
d. Private-API-Key to sign/hash the above Sting-to-Sign using HMAC-SHA256 (since API version is v2)
zy98x765-4321-0987-654w-32v1u0987654
e. Output of the generated Signature for  asgn  using the Sting-to-Sign and your Private-API-Key, hashed with HMAC-SHA256 (Base-64 and URL Encoded)
TaBkQ5xBJjwaTAP%2FcMoLKGkMTOYOZ3bDNLoSQB6Jh2o%3D
Read more about the above Signature Generation Process in API Authentication and Signature Generation

Request with Signature
f. Final  GET  request URL with queries  ak  ,  ts  and  asgn  (URL Encoded)
https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&asgn=TaBkQ5xBJjwaTAP%2FcMoLKGkMTOYOZ3bDNLoSQB6Jh2o%3D

2) Request with all query parameters
Request without Signature
a. GET request URL, with queries  ak   ts  ,  ir  (URL encoded) ,  rs  qr  but without  asgn  (Signature)
https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&ir=%7B%22recommendation%22%3Atrue%7D&rs=true&qr=true

b. Creating a String-to-Sign, calculated with Method + Endpoint + Values of query parametersin new lines and in ascending order of the parameter name (i.e., the new line characters "\n" followed by values of  ak  ,  ir  ,  qr  ,  rs  and  ts  in order, for this example)
String-to-Sign = "GET" +  "https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "{"recommendation":true}" + "\n" + "true" + "\n" + "true" + "\n" + "1635976200"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
{"recommendation":true}
true
true
1635976200
d. Private-API-Key to sign/hash the above Sting-to-Sign using HMAC-SHA256 (since API version is v2)
zy98x765-4321-0987-654w-32v1u0987654
e. Output of the generated Signature for  asgn  using the Sting-to-Sign and your Private-API-Key, hashed with HMAC-SHA256 (Base-64 and URL Encoded)
lR1lOIUIAa23E2vFoZjZaoZu26AuJ7GDdSy7Ef0aT20%3D
Read more about the above Signature Generation Process in API Authentication and Signature Generation

Request with Signature
f. Final  GET  request URL with queries  ak  ,  ts  ,  ir  (URL encoded) ,  rs  ,  qr  and  asgn  (URL Encoded)
https://api.mettl.com/v2/schedules/0x0x0x0x0x/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&ir=%7B%22recommendation%22%3Atrue%7D&rs=true&qr=true&asgn=lR1lOIUIAa23E2vFoZjZaoZu26AuJ7GDdSy7Ef0aT20%3D

Response

Upon making a successful request, if there are no errors, you will receive a JSON in one of the given formats
1) When a candidate has not taken the test
{
"status": "SUCCESS",
"candidate": {
"email": "name@email.com",
"registration": {
"Email Address": "name@email.com",
"First Name": "Name"
},
"testStatus": {
"status": "ToBeTaken"
},
"proctoringDetails": null
}
}

2) When a candidate's test in in progress
{
"status": "SUCCESS",
"candidates": {
"email": "name@email.com",
"registration": {
"Email Address": "name@email.com",
"First Name": "Name"
},
"testStatus": {
"status": "InProgress",
"startTime": "Fri, 18 Feb 2022 02:37:24 GMT",
"lastResponseTime": ""
},
"proctoringDetails": null
}
}

3) When a candidate has finished the test but results are still being generated
{
"status": "SUCCESS",
"candidates": {
"email": "name@email.com",
"registration": {
"Email Address": "name@email.com",
"First Name": "Name"
},
"testStatus": {
"status": "InProcessing",
"startTime": "Fri, 18 Feb 2022 02:37:24 GMT",
"endTime": "Fri, 18 Feb 2022 02:39:58 GMT"
},
"proctoringDetails": null
}
}

4) When a candidate has finished the test and results are generated
4.1) When no optional parameters are sent
{
"status": "SUCCESS",
"candidate": {
"email": "name@email.com",
"registration": {
"Email Address": "name@email.com",
"First Name": "Name"
},
"testStatus": {
"status": "Completed",
"startTime": "Fri, 18 Feb 2022 01:09:52 GMT",
"endTime": "Fri, 18 Feb 2022 01:10:37 GMT",
"completionMode": "Completed",
"result": {
"totalMarks": 1.0,
"maxMarks": 2.0,
"percentile": 100.0,
"attemptTime": 45.078,
"candidateCredibilityIndex": "Not Applicable",
"totalQuestion": 2.0,
"totalCorrectAnswers": 1.0,
"totalUnAnswered": 0.0,
"sectionMarks": [
{
"sectionName": "Section Name",
"totalMarks": 1.0,
"maxMarks": 2.0,
"timeTaken": 0.0,
"totalQuestion": 2.0,
"totalCorrectAnswers": 1.0,
"totalUnAnswered": 0.0,
"skillMarks": [
{
"skillName": "Skill Name",
"totalMarks": 1.0,
"maxMarks": 2.0,
"timeTaken": 45.0,
"totalQuestion": 2.0,
"totalCorrectAnswers": 1.0,
"totalUnAnswered": 0.0,
"questions": null,
"difficultyMarks": [
{
"level": "EASY",
"totalQuestion": 2,
"totalMarks": 1.0,
"totalUnAnswered": 0,
"maxMarks": 2.0,
"timeTaken": 45,
"totalCorrectAnswers": 1,
"questions": null
}
]
}
],
"difficultyMarks": [
{
"level": "EASY",
"totalQuestion": 2,
"totalMarks": 1.0,
"totalUnAnswered": 0,
"maxMarks": 2.0,
"timeTaken": 45,
"totalCorrectAnswers": 1
}
],
"questionWiseResponse": null
}
],
"analysis": null,
"difficultyMarks": [
{
"level": "EASY",
"totalQuestion": 2,
"totalMarks": 1.0,
"totalUnAnswered": 0,
"maxMarks": 2.0,
"timeTaken": 45,
"totalCorrectAnswers": 1
}
]
},
"performanceCategory": null,
"performanceCategoryVersion": null
},
"proctoringDetails": null
}
}

4.2) When  ir  parameter is enabled, the following highlighted parameters are sent in addition to the base response.
{
"candidate": {
"testStatus": {
"result": {
"analysis": {
"versionId": 999999,
"recommendation": [
{
"type": "Recommendation",
"value": "Cautiously Recommended"
}
]
}
}
}
}
}

4.3) When  rs  parameter is enabled, the following highlighted parameters are sent in addition to the base response.
{
"candidate": {
"testStatus": {
"result": {
"analysis": {
"versionId": 999999,
"responseStyles": [
{
"title": "Genuine",
"description": "No concerns or red flags just based on response style of candidate."
}
]
}
}
}
}
}

4.4) When  qr  parameter is enabled, the following highlighted additional parameters are sent in the response.
{
"candidates": {
"testStatus": {
"result": {
"sectionMarks": [
{
"skillMarks": [
{
"questions": [
{
"type": "la",
"questionText": "<div>Question Text</div>",
"questionType": "Long Answer",
"marksScored": 0.0,
"maxMarks": 1.0,
"hasWordLimit": false,
"wordLimit": 0,
"wordCount": 5,
"candidateResponse": "<p>Essay response for manual grading</p>"
}
],
"difficultyMarks": [
{
"questions": [
{
"type": "la",
"questionText": "<div>Question Text</div>",
"questionType": "Long Answer",
"marksScored": 0.0,
"maxMarks": 1.0,
"hasWordLimit": false,
"wordLimit": 0,
"wordCount": 5,
"candidateResponse": "<p>Essay response for manual grading</p>"
}
]
}
]
}
]
}
]
}
}
}
}

Completion Modes

In the above response JSON, you will also receive a parameter called completionMode which can be helpful in understanding how a candidate's test got finished. The possible values for this parameter and their description can be found in table below- 

completionMode (in API Response)Test Finish Mode (in Candidate Reports)

Description

AutoCompletedAuto SubmitTest Time finished before candidate could attempt all questions.
NABlocked Candidate blocked at the authorization stage (For Proctored Test with Authorization On).
BrowsingToleranceExceededBrowsing Tolerance ExceededWhen browsing tolerance is set and test taker navigates away from the test window more than the permissible number or times (browsing tolerance limit).
ExpiredExpiredIf candidate gets disconnect (Loss of internet connection, etc) or his/her system shuts down abruptly and he/she is unable to resume the test.
CompletedNormal Finish Test button Clicked.
ParentFinishedNormalThe background parent window is closed.
ProctoredFinish Proctored Finish Image Proctored Test ended by Proctor.
ResumeEnabledResume EnabledCandidate allowed to resume tests from same point where test got over, only can be done if initial status was Expired.
SuspiciousSoftwareFinish Suspicious Software FinishSuspicious Software detected Eg TeamViewer, SplashTop etc also found running and Mettl automatically closes test.
CandidateClosed Test Window ClosedTest Window Closed without clicking on Finish Test.