Get Candidates Profile Data


You can get profile and participation data of candidates using following API endpoint:

 https://api.hackerearth.com/partner/hackerearth/candidate-profiles/

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

client_id, client_secret and candidate_emails 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.

candidate_emails

Type: List

Description: The candidate email ids for which we have to get profile.

Sample request using python

#!/usr/bin/env python

import json
import requests

CLIENT_ID = "d8a20ae8e475209e0eb1faa72ede88a174423cc2029c.api.hackerearth.com"
CLIENT_SECRET = "2b0ff29f4f8751487450604cdab5611e6135f41c"
CANDIDATE_EMAILS = ["hacker@hackerearth.com"]

payload = {
    'client_id': CLIENT_ID,
    'client_secret': CLIENT_SECRET,
    'candidate_emails': CANDIDATE_EMAILS
}
r = requests.post("https://api.hackerearth.com/partner/hackerearth/candidate-profiles/", data=json.dumps(payload))
print r.json()

Using cURL

curl --data '{"client_id":"d8a20ae8e475209e0eb1faa72ede88a174423cc2029c.api.hackerearth.com","client_secret":"2b0ff29f4f8751487450604cdab5611e6135f41c","candidate_emails":["hacker@hackerearth.com"]}' https://api.hackerearth.com/partner/hackerearth/candidate-profiles/


Response

Response returned will be in JSON format.

Sample response

{
    "mcode": "SUCCESS",
    "message": "Request successful",
    "candidates_data": {
        "hacker@hackerearth.com": [
            {
                "test_name": "Sample Test",
                "test_link": "http://hck.re/jc195",
                "candidate_score": 60.0,
                "total_score": 100.0,
                "qualified": "Yes",
                "finish_date": "2019-07-28T16:30:00+00:00",
                "report_link": "https://p.hck.re/g7sF"
            }
        ]
    },
     "candidates_not_found": [
        "hacker1@hackerearth.com"
    ],
}

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
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.

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: 'candidate_emails'"
    ],
    "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 any other issue occurred do reach us out at api@hackerearth.com

Notifications
View All Notifications

?