Candidate Report


You can get a candidate report for a particular test using following API endpoint:

 https://api.hackerearth.com/partner/hackerearth/events/candidates/report/

Authentication

The client authentication is done using your unique client_id and client_secret.

You can refer to your Dashboard settings, forclient_id and client_secret under API details.

client_id

Type: String

Description: client_id is a 67 character random key that serves as an identification for a particular client and must be provided when communicating with the API as a parameter to the API endpoint.

Example: d8a20ae8e475209er4b1faa72ede88a174423cc2029c.api.hackerearth.com

client_secret

Type: String

Description: client_secret is a 40 character random key that serves as an identification for a particular client and must be provided when communicating with the API as a parameter to the API endpoint.

Example: 2b0ff29f4f8751487540604cdab5611e6135f41c


Making requests

Candidate report is accessible only for published test.

client_id, client_secret, test_id and email are the required parameters for making request to this API endpoint.

All the requests to the API must be made using POST request method.

client_id and client_secret are explained above.

test_id

Type: Integer

Description: test_id is a unique integer for your test. Refer to this article for a betterunderstanding. In this article, Recruiter API ID is the test_id.

Example: 5841

email

Type: String

Description: The candidate email id for the report to be generated.

Sample request using python

#!/usr/bin/env python

import json
import requests

CLIENT_ID = "d8a20ae8e475209e0eb1faa72ede88a174423cc2029c.api.hackerearth.com"

CLIENT_SECRET = "2b0ff29f4f8751487450604cdab5611e6135f41c" TEST_ID = 53 EMAIL = "hacker@hackerearth.com"

payload = {
    'client_id': CLIENT_ID,
    'client_secret': CLIENT_SECRET,
    'test_id': TEST_ID,
    'email': EMAIL
}
r = requests.post("https://api.hackerearth.com/partner/hackerearth/events/candidates/report/", data=json.dumps(payload))
print r.json()

Using cURL

curl --data '{"client_id":"d8a20ae8e475209e0eb1faa72ede88a174423cc2029c.api.hackerearth.com","client_secret":"2b0ff29f4f8751487450604cdab5611e6135f41c","test_id":20, "email":"hacker@hackerearth.com"}' https://api.hackerearth.com/partner/hackerearth/events/candidates/report/


Response

Response returned will be in JSON format.

Sample response

{
    "emessage": [],
    "mcode": "SUCCESS",
    "test_info": {
        "total_questions": 2,
        "test_id": 20,
        "max_score": 104,
        "title": "Your test title"
    },
    "candidate_report": {
        "phone_number": "9876543210",
        "status": "active",
        "start_datetime": "02-05-2015 11:12:23 UTC",
        "finish_datetime": "02-05-2015 11:34:30 UTC",
        "full_report_url": "https://www.hackerearth.com/recruiter/your-test-name/candidates-report/hash1/hash2/",
        "anon_report_url": "https://www.hackerearth.com/recruiter/your-test-name/candidates-report/hash1/hash2/",  // This field is subjected to subscription.
        "candidate_assessment_report_url": "https://www.hackerearth.com/recruiter/your-test-name/candidate-performance-report/hash1/hash2/",
        "full_report_pdf": "https://he-pdf.s3.amazonaws.com/reports/id-test_id-date.pdf",
        "anon_report_pdf_url": "https://he-pdf.s3.amazonaws.com/reports/id-test_id-date-anonymous.pdf",
        "time_taken": "1:00:00",
        "name": "Foo Bar",
        "institute": "Foo Bar Institute",
        "problem_type_scores": {
            "Programming": 0.0,
            "Multiple Choice Questions": 0.0
        },
        "section_scores": {
           "Programming": {
                "PSection1": 0.0,
                "PSection2": 0.0
            },
            "Multiple Choice Questions": {
                "MSection1": 0.0
            }
        },
        "score": 0,
        "questions_attempted": 1,
        "graduation_year": "2013",
        "percentage": 0,
       "email":"hacker@hackerearth.com",
        "custom_details": {
            "Stream/Branch": "CSE",
            "Degree": "B.Tech/B.E.",
            "Resume": "http://he-s3.s3.amazonaws.com/hackathon/am-ex-challenge/misc/a0a11516cb-kforJobFinal.pdf",
            "CGPA": "6.5",
            "College": "Other College",
            "Graduation Year": "Other"
              },
        "candidate_id": ""
        "skill_scores": {
            "Skill1": "45.0%",
            "Skill2": "100.0%",
            "Skill3": "75.0%"
        },
     "skill_scores_averages": {
            "Skill1": "65.0%",
            "Skill2": "100.0%",
            "Skill3": "66.7%"
        },
        "start_time_isoformat": "2015-05-02T11:12:23+00:00"
        "end_time_isoformat": "2015-02-05T11:34:30+00:00"
        "cutoff_qualified": "No"
   },
   "ecode": [],
   "message": "Request successful"
}

mcode

Type : String

Description: Message code abbreviated as mcode.

message

Type: String

Description: A message for user regarding the success of request.

message and mcode are related to each other according to the following table:

mcode message
SUCCESS Request successful
FAILED Request failed

ecode

Type: List

Description: Error codes abbreviated as ecode.

emessage

Type: List

Description: A message explaining the error occurred during request processing.

emessage and ecode are related to each other according to the following table:

ecode emessage
AUTHFAILED Authentication Failed
ARGMISSING Request argument missing
MUSTBEINT Test ID must be integer
INVALIDEMAIL Invalid email(s) exist.
TESTNOTFOUND Test not found
CANDIDATENOTFOUND Candidate not found
NOREPORT No report exist.
LIMITEXCEEDED Client exceeded its request limit. Please contact support@hackerearth.com.
RATELIMITEXCEEDED The rate at which the API requests are made has reached. Please try again after one minute.
ACCESSERROR You are not authorized to access this feature. Please contact support@hackerearth.com.

candidate_report

Type: Dictionary (JSON)

Description: This JSON will contain all the details about the candidate i.e. name, phone_number, status, start_datetime, finish_datetime, time_taken, institute, full_report_url, anon_report_url, candidate_assessment_report_url, score, questions_attempted, graduation_year, questions_attempted, percentage, email, candidate_id, custom_details (map of Custom details fields and their values filled by the candidate), skill_scores and skill_scores_averages.

cutoff_qualified will have value "Yes" if candidate qulifies cutoff if not "No". if cutoff score for event is not set then value will be "NA".

Candidate's personal details like phone_number, institute, graduation_year and candidate_id will be set in response, if these fields were marked in Candidate Settings under Test Settings section and candidate has filled these details, otherwise, the value of these will be null

Note: anon_report_url i.e. Anonymous report url will be provided only if your company has subscribed to the anonymous reports feature.

test_info

Type: Dictionary (JSON)

Description: This JSON will contain all the details about test i.e total_questions, test_id, title, max_score.


Errors (Mishandled API responses)

If you have provided wrong client_id or client_secret, the JSON response returned will look like:

{
    "message": "Request failed",
    "ecode": [
         "AUTHFAILED"
    ],
    "emessage": [
        "Authentication Failed"
    ],
    "mcode": "FAILED"
}

If mandatory POST arguments are not provided, the JSON response returned will look like:

{
    "message": "Request failed",
    "ecode": [
        "ARGMISSING"
    ],
    "emessage": [
        "Request argument missing: 'test_id'"
    ],
    "mcode": "FAILED"
}

If the type of test_id is not integer, then the JSONresponse returned will look like:

{
    "message": "Request failed",
    "ecode": [
        "MUSTBEINT"
    ],
    "emessage": [
        "Test ID must be integer"
    ],
 "mcode": "FAILED"
}

If wrong test_id is provided or the test has already been deleted, then the JSON response returned will look like:

{
    "message": "Request failed",
    "ecode": [
        "TESTNOTFOUND"
    ],
    "emessage": [
        "Test not found"
    ],
    "mcode": "FAILED"
}

Ifuser is not authorized to access the test, the JSON response returned will look like:

{
    "message": "Request failed",
    "ecode": [
        "ACCESSERROR"
    ],
 "emessage": [
"You are not authorized to access this feature. Please contact support@hackerearth.com."
    ],
    "mcode": "FAILED"
}

If the limit of API requests (15000 requests) is reached,then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
        "LIMITEXCEEDED"
    ],
  "emessage": [

"The limit of the API requests has been reached. Contact support@hackerearth.com." ], "mcode": "FAILED" }

If the rate (60 per min or 10000per day) at which API requests are made by a specific user is reached, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
  "RATELIMITEXCEEDED"
    ],
    "emessage": [
        "The rate at which the API requests are made has reached. Please try again after some time."
    ],
    "mcode": "FAILED"
}

If no candidateshave taken the test, then the JSON response returned will look like:

{
    "message": "Request failed",
    "ecode": [
        "NOREPORT"
    ],
    "emessage": [
        "No report exist."
    ],
    "mcode": "FAILED"
}

If invalid email id provided, then the JSON response returned will be like:

{
    "message": "Request failed",
    "ecode": [
        "INVALIDEMAIL"
    ],
    "emessage": [
        "Invalid email(s) exist"
    ],
    "mcode": "FAILED"
}

If the candidate with the provided email id was not invited for the test or has not taken the test, then the JSON response returned will be like:

{
    "message": "Request failed",
    "ecode":[
        "CANDIDATENOTFOUND"
    ],
    "emessage": [
        "Candidate not found"
    ],
    "mcode": "FAILED"
}

If any other issue occurred do reach us out at api@hackerearth.com

Notifications
View All Notifications

?