7. Get Assessment

7. Get Assessment

Definition

This  GET  API is used to fetch the details of a particular Assessment in your account (such as assessment name, id, duration, tests taken, max marks, candidate registration fields, sectional info, etc.).
      *PDF documentation reference - Section 4.3 Get details of a particular Assessment

where, assessment-id is the unique Id of the Assessment for which you want to fetch the details.

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

Example

Request without Signature
a.  GET  request URL, with queries  ak  and  ts  but without  asgn  (Signature)
https://api.mettl.com/v2/assessments/999999?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/assessments/999999"  + "\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)
CEbvhyoIhg6tqMWGviyyiYuF6fX0pQlvOeiC9REdb%2Fc%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/assessments/999999?ak=ab12c345-6789-0123-456d-78e9f0123456&ts=1635976200&asgn=CEbvhyoIhg6tqMWGviyyiYuF6fX0pQlvOeiC9REdb%2Fc%3D

Response

Upon making a successful request, if there are no errors, you will receive a JSON in the given format
{
"status": "SUCCESS",
"assessment": {
"id": 698998,
"duration": 10,
"testsTaken": 6,
"name": "Sample Test",
"instructions": "",
"defaultInstructions": "<h2><b>THINGS TO REMEMBER</b></h2><ul style=\"list-style-type:decimal;margin: 10px 20px;\"><li>Before starting the test, please close all chat windows, screen-saver(s), etc. and make sure that you have a stable internet connection.</li><li>Pressing F5 at any time during the test will cause it to end immediately</li><li>If your computer system shuts down suddenly due to your power supply being disconnected, you can resume the test from the same question that you were attempting earlier. All your previous answers are already saved.</li><li>Your test will open in a new popup window once you press the launch test button. </li><li>When resuming, please start the test as you did before and use the same registration details. </li></ul<div class=\"section-duration\">TEST DETAILS<br /><table class=\"table\"><tr><th>Section Name</th><th>No. of Questions</th><th>Time Limit (Mins)</th></tr><tr><td>Section #1</td><td>6</td><td>Untimed*</td></tr></table>*Untimed: These sections are without any specific time limit. You can answer these sections within the total assessment time limit.<br />i.e Total Time of Untimed Sections = Total Time of Test - Total Time of Timed Sections<br /><b>Total Test Duration:</b> 10  Mins</div>",
"allowCopyPaste": false,
"exitRedirectionURL": "",
"customAssessmentName": "",
"showReportToCandidateOnExit": false,
"onScreenCalculator": false,
"fixedSectionOrder": false,
"createdAt": "Thu, 26 Aug 2021 03:50:13 GMT",
"maxMarks": 6.0,
"markingScheme": "FIXED",
"assessmentType": "REGULAR",
"enableQRUpload": false,
"sections": [
{
"name": "Section #1",
"instructions": "",
"duration": 0,
"isTimed": false,
"order": 1,
"randomizeQuestions": false,
"randomizeOptions": false,
"allQuestionsMandatory": false,
"isMinimumQuestion": false,
"minimumQuestion": 15,
"skills": [
{
"name": "Test Topic 1",
"level": "EASY",
"questionCount": 5,
"source": "Custom",
"questionType": "AllType",
"duration": 0,
"correctGrade": 1.0,
"incorrectGrade": 0.0,
"questionPooling": true
},
{
"name": "Test Topic 1",
"level": "DIFFICULT",
"questionCount": 1,
"source": "Custom",
"questionType": "AllType",
"duration": 0,
"correctGrade": 1.0,
"incorrectGrade": 0.0,
"questionPooling": true
}
]
}
],
"assessmentTags": [
{
"useCaseName": "Others",
"useCaseSubTags": {}
}
],
"registrationFields": [
{
"name": "Email Address",
"type": "TextBox",
"required": true,
"validate": false
},
{
"name": "First Name",
"type": "TextBox",
"required": true,
"validate": false
}
],
"assessmentPerformanceCategory": null,
"apiAssessmentLanguage": {
"value": 1,
"language": "English",
"direction": "ltr",
"langColumn": "English_Text",
"assessmentId": null
},
"assessmentAdditionalInfo": {
"versionId": -1,
"assessmentRecommendations": null
}
}
}