18. Get All Results of Candidate in Account

18. Get All Results of Candidate in Account

Definition

This  GET  API is used to fetch all status and results of a particular candidate from each schedule/ test link in your account (such as candidate registration fields, test status, proctoring details and test results if the test is finished).
      *PDF documentation reference - Section 7 Get all details for a particular candidate

where, candidate-email-id is the unique email Id of the candidate for which you want to fetch all status and results from your account.

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/candidates/{candidate-email-id}?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}      

Optional parameters


Query Parameter


Description

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.

limit

Number of candidate status and results to fetch from your schedule/ test link.

You can input a value from 1 to 100, with the default value being 20. Only available in v3.

offset

Returns the list of candidate status and results starting from the offset position.

You can input a value from 0 to 1 less than the total number of the specified candidates status and results in your account, with the default value being 0. Only available in v3.


 GET  request syntax with all parameters:
https://api.mettl.com/v3/candidates/{candidate-email-id}?ak={Public-Api-Key}&ts={Timestamp}&asgn={Signature}&qr={Boolean}&limit={Limit-Number}&offset={Offset-Number}

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/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/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)
cFUa4E06YnR0xcYGxdKWTJGPOJI1QkP0xNtgNmarnmA%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/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&asgn=cFUa4E06YnR0xcYGxdKWTJGPOJI1QkP0xNtgNmarnmA%3D

2) Request with all query parameters
Request without Signature
a. GET request URL, with queries  ak   ts  ,  qr  ,  limit  and  offset  but without  asgn  (Signature)
https://api.mettl.com/v3/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&qr=true&limit=10&offset=20

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  ,  limit  ,  offset  ,  qr  and  ts  in order, for this example)
String-to-Sign = "GET" +  "https://api.mettl.com/v3/candidates/name@email.com"  + "\n" + "ab12c345-6789-0123-456d-78e9f0123456"  + "\n" + "10" + "\n" + "20" + "\n" + "true" + "\n" + "1635976200"
c. Output of the Sting-to-Sign created above
ab12c345-6789-0123-456d-78e9f0123456
10
20
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)
bfqO%2BWttX0jQk%2FyAPDDiS2HTIxH3NSuASsfTuS6nCXs%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  ,  qr  ,  limit  ,  offset  and  asgn  (URL Encoded)
https://api.mettl.com/v3/candidates/name@email.com?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&qr=true&limit=10&offset=20&asgn=bfqO%2BWttX0jQk%2FyAPDDiS2HTIxH3NSuASsfTuS6nCXs%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",
"testInstances": [
{
"registrationDetails": {
"First Name": "Name",
"Email Address": "name@email.com"
},
"assessmentId": 999999,
"assessmentDuration": 10,
"assessmentName": "Assessment Name",
"assessmentStatus": "active",
"scheduleStatus": "active",
"accessKey": "0x0x0x0x0x",
"scheduleTitle": "Test Link Name",
"testStatus": {
"status": "ToBeTaken"
},
"proctoringDetails": null
}
]
}

2) When a candidate's test in in progress
{
"status": "SUCCESS",
"testInstances": [
{
"registrationDetails": {
"First Name": "Name",
"Email Address": "name@email.com"
},
"assessmentId": 999999,
"assessmentDuration": 10,
"assessmentName": "Assessment Name",
"assessmentStatus": "active",
"scheduleStatus": "active",
"accessKey": "0x0x0x0x0x",
"scheduleTitle": "Test Link 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",
"testInstances": [
{
"registrationDetails": {
"First Name": "Name",
"Email Address": "name@email.com"
},
"assessmentId": 999999,
"assessmentDuration": 10,
"assessmentName": "Assessment Name",
"assessmentStatus": "active",
"scheduleStatus": "active",
"accessKey": "0x0x0x0x0x",
"scheduleTitle": "Test Link 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",
"testInstances": [
{
"registrationDetails": {
"First Name": "Name",
"Email Address": "name@email.com"
},
"assessmentId": 999999,
"assessmentDuration": 10,
"assessmentName": "Assessment Name",
"assessmentStatus": "active",
"scheduleStatus": "active",
"accessKey": "0x0x0x0x0x",
"scheduleTitle": "Test Link",
"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  qr  parameter is enabled, the following highlighted additional parameters are sent in the response.
{
"testInstances": [
{
"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.