PUT test-result/…

Submits a completed test.

Submitting a test is only required for navigable tests. Non-navigable tests are submitted automatically upon answering the last question.

Resource URL

https://www.drillster.com/api/2.1.1/test-result/{test_id}

Parameters

Field Type Description
test_id
required
String The ID of the test definition. This defines the test itself, not the individual instances done by users.

Example value: 7OuHq7RcQOCsnGWR58TnBw
user_id
optional
String The user ID of the user to submit test details for. If omitted, the details for the own user account are returned.

Example value: j7Yvq-ynQeWNnHTNWRV9wA
ticket
optional
String A ticket number issued by Drillster for use with anonymous tests.

Example value: jK8TJ11kcA7YvqUhd873kJ

Either a user ID or a test ticket can be used, not both!

If a PUT request has no body (i.e. the body is empty), it is still mandatory to include a Content-Length header (i.e. Content-Length: 0). Not all HTTP clients do this automatically. For more information, please see RFC 2616.

Response

A 2.1.1 TestResult object containing the test ID, achieved score (including any possible transformed scores), the started and completed timestamps and duration. The availability of the score is dependent on the disclosure settings in the test definition.

Example request

PUT https://www.drillster.com/api/2.1.1/test-result/HmOZ3fMbRxulVH77XYR8nQ/GNiyJoCtRTyQmmy-P9xlfA

Response

{
  "id": "5eLSAhDXxDtLQoZnpqKpng",
  "score": {
    "percentage":100,
    "transformations":[]
  },
  "started": "2017-11-10T15:07:58Z",
  "completed": "2017-11-10T15:09:09Z",
  "duration": 1
}

Error responses

The following error situations are possible:

ID Response code Description
not_found 404 (Not found) Requested test result not found.
invalid_test_type 400 (Bad request) The test cannot be completed manually, because is does not allow question navigation.
already_completed 400 (Bad request) The test was already completed.
not_all_questions_answered 400 (Bad request) Not all questions have been answered and submitting a non-completed test is not allowed in this case.