Mettl is an Online Assessment Platform to conduct tests and measure talent. It provides content across psychometric assessments, aptitude tests and IT/Non-IT domain tests, along with a SaaS platform to conduct secure online assessments. It enables organizations to build winning teams by taking credible people decisions across two key areas: Hiring and Development.
Integration of Mettl in web application is quite easy and straight forward. For our integration, we will assume that a test has already been created in your Mettl Account. Please note that Mettl integration is a PAID API and can be purchased on https://mettl.com/
After paying for Mettl, we need to contact the Mettl Support who will provide us with a set of public and private API keys which we will be using to fetch the results of the test.
I have referred to the support documentation provided by them : Documentation. Mettl provides us with many types of tests and test features but we are using only the basic test taking and fetching its result.
Mettl also provides us with a Demo Tool through which we can test our API Integration.
For the users to take the test, we will forward the users to the following link:
1 2 3 |
… <a href="//tests.mettl.com/authenticateKey/testId”">Click here to start your Test</a> //Test Id is available in test details on the Mettl Dashboard … |
Please note that you need to have the email id used by the user to fetch the test results from Mettl.
To fetch the results from Mettl, we will use the following Javascript API :
1 2 3 4 5 6 7 8 9 |
Request URL : http://api.mettl.com/v1/candidates/{candidate-email-id} Method : GET Arguments : - Mettl Public Key - Current UTC Timestamp - HMAC-SHA1 encoded String of Concatenated String and Private Key. To generated the concatenated string : Concatenated String : HTTPVerb + API URI + '\n' + PublicKey+'\n'+ Timestamp; |
1 |
API Request: http://api.mettl.com/v1/candidates/{candidate-email-id}?ts={timestamp}&ak={xxxxxxxxxxxx}&asgn={xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx} |
Response on Success : JSON containing all details for a particular candidate
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
{ “status” : “SUCCESS” "testInstances": [{ "registrationDetails": {{ "email": "4@mettl.com", "registration": {}, "testStatus": { "status": "ToBeTaken" } "proctoringDetails": "null" }] "paging": { "previous": "null" "next":"http://api.mettl.com/v1/schedules/2ee77c15/candidates?ak=f26dc4b2-61a2-419d-b2df-221f21b177d2&asgn=ld9sZxV4YXnJ7nrqg%2FdDLTRqqEU%3D&limit=1&offset=1&sort=testStartTime&sort_order=desc&ts=1516105605" } "status":”SUCCESS” } }, "assessmentId": 6206, "assessmentDuration": 20, "assessmentName": "chota cs", "assessmentStatus": "active", "scheduleStatus": "active", "accessKey": "o19236068", "scheduleTitle": "first", "testStatus": { "status": "Completed", “startTime” : ”Tue, 24 Apr 2012 14:08:01 GMT”, “endTime” : ”Tue, 24 Apr 2012 15:28:34 GMT”, "completionMode": "Expired", "result": { "totalMarks": 0, "maxMarks": 3, "percentile": 100, "attemptTime": 900, "candidateCredibilityIndex": "High", // Low, Medium or Not Applicable "totalQuestions":3, "totalCorrectAnswers":0, "totalUnAnswered":1, "attemptTime": 102, "sectionMarks": [{ "sectionName": "Section #1","totalMarks": 1,"maxMarks": 10,"timeTaken": 0, "totalQuestion": 10,"totalCorrectAnswers": 1,"totalUnAnswered": 9,"skillMarks": [{ "skillName": "CST-General_Hindi", "totalMarks": 1, "maxMarks": 10, "timeTaken": 900, "totalQuestion": 10, "totalCorrectAnswers": 1, "totalUnAnswered": 9, "questions": "null", "difficultyMarks": [{ "level": "EASY", "totalQuestion": 10, "totalMarks": 1, "totalUnAnswered": 9, "maxMarks": 10, "timeTaken": 900, "totalCorrectAnswers": 1, "questions": "null" }] }] "difficultyMarks": [{ "level": "EASY", "totalQuestion": 10, "totalMarks": 1, "totalUnAnswered": 9, "maxMarks": 10, "timeTaken": 900, "totalCorrectAnswers": 1, }] }] "difficultyMarks": [{ "level": "EASY", "totalQuestion": 10, "totalMarks": 1, "totalUnAnswered": 9, "maxMarks": 10, "timeTaken": 900, "totalCorrectAnswers": 1 }] } "pdfReport": "https://mettl.com/corporate/analytics/downloadPdfReport?key=R9OSzne5bSUCJ0rkLgwujA%3D%3D&fname=Aarjav&aname=PHP+Advanced+Level+Assessment" "htmlReport": "https://mettl.com/corporate/analytics/share-report?key=R9OSzne5bSUCJ0rkLgwujA%3D%3D" "performanceCategory": "null", "performanceCategoryVersion": "null" } "proctoringDetails": { "authorization": { "lastAuthorizer": { "name": "Aarjav", "email": "aarjav11@gmail.com", "time": "Fri, 18 Mar 2016 07:10:33 GMT" } } } } |
Response on Error : JSON containing all details for the error
1 2 3 4 5 6 7 |
{ “status”: “error”, “error” : { “code”: Error-Code, “message”: Error-Message } } |
Error Codes :
1 2 |
E004 : Invalid format of Email Id E009 : Invalid Email Id |
Complete example for getting Response via JavaScript API :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
var email = "${user.emailId}" // provided by User function getResults(email){ var HTTPVerb = 'GET'; var ApiUri = 'http://api.mettl.com/v1/candidates/'+email; var publicKey = "${grailsApplication.config.mettlPublicKey}"; // Public Key provided by Mettl saved in config.groovy var privateKey = "${grailsApplication.config.mettlPrivateKey}"; // Private Key provided by Mettl saved in config.groovy var timestamp = Math.floor(new Date().getTime() / 1000); // Current UTC Timestamp var message = HTTPVerb + ApiUri + '\n' + publicKey + '\n' + timestamp; var encrypted = CryptoJS.HmacSHA1(message, privateKey); var mettl_signature = encodeURIComponent(CryptoJS.enc.Base64.stringify(encrypted)); var uri = ApiUri + "?ak=" + publicKey + "&asgn=" + mettl_signature + "&ts=" + timestamp; $.ajax({ url: uri, type: HTTPVerb, success: function(response){ if(response.status=="SUCCESS"){ console.log(response) } else { console.log("Test Not taken by User!"); } }, error: function(error){ console.log("Some Error Occurred! "+error); } }); } |
Recent Comments