Get Started

The TestDome API allows apps to interact directly with the TestDome platform. Some typical use cases include the following:

  • Automated inviting of candidates to test (e.g., directly from the company HR tool)
  • Automated pulling of candidate reports as soon as they finish a test

The TestDome API is made around several RESTful web services.

Call your first service

Request access to TestDome API

Before you make your first API call, API access needs to be enabled on your TestDome account. To enable API access, please contact TestDome Support.

Set up OAuth2 authentication

Your app will need to contact TestDome services on your behalf. Authentication via OAuth2 allows your app to operate on behalf of your account.

These are the steps for OAuth2 authentication:

  1. Send a POST request that contains the email used for login to your TestDome account and the API password that you received in the previous step to https://testdome/api/v1/token.
  2. After successful authentication, the response will contain the access token.
  3. Use this token as part of the authorization header in each of your subsequent API calls. This token will be valid for 30 minutes, after which time you'll need to request a new token.

Below is code that demonstrates this part.

The full JavaScript sample can be downloaded here.

function signIn(email, apiPassword) {
  var loginData = {
    grant_type: 'password',
    username: email,
    password: apiPassword
  };
  $.ajax({
    type: 'POST',
    url: 'https://testdome.com/api/v1/token',
    data: loginData
  }).done(function (data) {
    // Cache the access token in session storage.
    sessionStorage.setItem("TestDomeApiAccessToken", data.access_token);
  }).fail(showError);
}

The full C# sample can be downloaded here.

static HttpClient Authorize(string email, string apiPassword)
{
    // Create HttpClient.
    HttpClient client = new HttpClient()
    {
        BaseAddress = new Uri("https://testdome.com/api/v1/")
    };
    client.DefaultRequestHeaders.Accept.Clear();
    client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
    // Get token.
    FormUrlEncodedContent content = new FormUrlEncodedContent(new[]
    {
        new KeyValuePair<string, string>("grant_type", "password"),
        new KeyValuePair<string, string>("username", email),
        new KeyValuePair<string, string>("password", apiPassword)
    });
    HttpResponseMessage response = client.PostAsync("token", content).Result;
    string result = response.Content.ReadAsStringAsync().Result;
    string accessToken = JObject.Parse(result)["access_token"].ToString();
    // Set authorization header.
    client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
    return client;
}

Call the service

You now have everything ready to make your first action using the TestDome API. You first need to call the right service with the right arguments. Below is a sample that shows how to get all tests from the account.

The full JavaScript sample can be downloaded here.

function getTests() {
  var token = sessionStorage.getItem("TestDomeApiAccessToken");
  var headers = {};
  headers.Authorization = 'Bearer ' + token;
  
  $.ajax({
    type: 'GET',
    url: 'https://testdome.com/api/v1/tests',
    headers: headers
  }).done(function (data) {
    displayTests(data);
  }).fail(showError);
}

The full C# sample can be downloaded here.

static IEnumerable<Test> GetTests(HttpClient client)
{
    HttpResponseMessage response = client.GetAsync("tests").Result;
    response.EnsureSuccessStatusCode();
    return response.Content.ReadAsAsync<IEnumerable<Test>>().Result;
}

Pricing

Only the inviting of candidates incurs a charge. The prices for inviting candidates over the API are the same as for inviting candidates over the TestDome website. You can find prices here.

Services

To find out more about our API services, go to the Services page.