Coremetrix API

The Coremetrix Report API facilitates the retrieval of attempt information and scores. This section covers the process of polling the API and checking the resource status until the required information is available..

Note: There is a separate section dedicated to webhooks, titled "Webhooks."
api-poling

The attempt status can be one of the following:

StatusDescription
INCOMPLETEQuiz is yet to be completed, no scores will be present
COMPLETED_SCOREDQuiz has been completed, expect scores present for all enabled models.
COMPLETED_PARTIALLY_SCOREDQuiz has been completed, expect scores present for some models and flags present for other models. Note that not all quizzes have multiple models deployed.
COMPLETED_NOT_SCOREDUnable to score quiz, possible reasons: quiz was answered too fast (no profile will be generated and a FAST_CLICK flag will be present instead), no models have been set up / enabled, etc.

Some extra information can be deducted by observing the timing information:

timestampDescription
loadQuiz has been loaded in the browser but no answer has been submitted
load + startQuiz has been started and at least one answer has been submitted
load + start + completeQuiz has been completed, all answers have been submitted

Attempts report by custom id

The API can return one report if we filter by customId. The custom id should be the same puid used when taking the quiz..

Note: The report will contain most of the time one quiz attempt as quiz retakes are not allowed in the space of 3 months.
gethttps://api.coremetrix.com/report/attempts?customId={id}
Sample response

{
  • "customId": "123456789XYZ",
  • "attempts": [
    • {
      • "name": "sandbox",
      • "flags": [ ],
      • "timings": {
        • "load": 1539084815550,
        • "start": 1539086050697,
        • "end": 1539086175830
        },
      • "id": "ee1a392f-eccc-4f54-bd72-993e11ddde13",
      • "status": "COMPLETED_SCORED",
      • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
      • "scores": [
        • {
          • "value": 248.25117341335454,
          • "model": "sandbox"
          }
        ],
      • "user": {
        • "accommodation": "Private housing",
        • "age": "20-24",
        • "education": "BSc",
        • "maritalStatus": "Single",
        • "occupation": "Self-employed"
        }
      }
    ]
}

Attempt by attempt id

The API can return one attempt by id.

:(gethttps://api.coremetrix.com/report/attempts/{attemptId}
Sample response

{
  • "name": "sandbox",
  • "flags": [ ],
  • "timings": {
    • "load": 1539084815550,
    • "start": 1539086050697,
    • "end": 1539086175830
    },
  • "clientInfo": {},
  • "id": "ee1a392f-eccc-4f54-bd72-993e11ddde13",
  • "status": "COMPLETED_SCORED",
  • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
  • "scores": [
    • {
      • "value": 248.25117341335454,
      • "model": "sandbox"
      }
    ],
  • "user": {
    • "accommodation": "Private housing",
    • "age": "20-24",
    • "education": "BSc",
    • "maritalStatus": "Single",
    • "occupation": "Self-employed"
    }
}

Batch attempts report (7 days)

The reports can be filtered by quizId and a date range. quizId, from and to query params are optional. The dates are in ISO8601 format, if dates are not provided then to defaults to the current date and time, and from defaults to seven days earlier than to. The maximum difference between from and to cannot be greater than 7 days.

Note:

Test attempts are filtered out by default but can be made explicitly available by the includeTestparameter.

:(: /report/attempts?quizId=63f751bb-7a2b-4c86-bfbc-217c1104b36e&from=2019-07-01T00:00:01Z&to=2019-07-05T16:01:02Z&includeTest=true

gethttps://api.coremetrix.com/report/attempts
Sample response

{
  • "results": [
    • {
      • "customId": "a5b7c1e5-460f-45e2",
      • "attempts": [
        • {
          • "name": " sandbox",
          • "flags": [ ],
          • "timings": {
            • "load": 1562226135859
            },
          • "id": "05a50ee4-4ffa-45a1-b01d-b043e31cfc41",
          • "status": "INCOMPLETE",
          • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
          • "scores": [ ]
          }
        ]
      },
    • {
      • "customId": "b28acd4b-0755-4417",
      • "attempts": [
        • {
          • "name": "sandbox",
          • "flags": [ ],
          • "timings": {
            • "load": 1562225934584,
            • "start": 1562225937347,
            • "end": 1562225956220
            },
          • "id": "730b9c99-5c68-459b-b583-d96743cfe03f",
          • "status": "COMPLETED_SCORED",
          • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
          • "scores": [
            • {
              • "value": 256.67901827947344,
              • "model": "sandbox"
              }
            ],
          • "user": {
            • "accommodation": "Private housing",
            • "age": "20-24",
            • "education": "BSc",
            • "maritalStatus": "Single",
            • "occupation": "Self-employed"
            }
          }
        ]
      },
    • {
      • "customId": "91fede51-dfcf-4670",
      • "attempts": [
        • {
          • "name": "sandbox",
          • "flags": [ ],
          • "timings": {
            • "load": 1562225977118,
            • "start": 1562225978135,
            • "end": 1562225984913
            },
          • "id": "2db0e167-824d-4e78-98ae-a610387cfddf",
          • "status": "COMPLETED_SCORED",
          • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
          • "scores": [
            • {
              • "value": 234.41970196460838,
              • "model": "sandbox"
              }
            ],
          • "user": {
            • "accommodation": "Private housing",
            • "age": "20-24",
            • "education": "BSc",
            • "maritalStatus": "Single",
            • "occupation": "Self-employed"
            }
          }
        ]
      }
    ]
}

The Consent APIConsent API returns information about users consent.

Sample response

{
  • "name": "sandbox",
  • "flags": [ ],
  • "timings": {
    • "load": 1539084815550,
    • "start": 1539086050697,
    • "end": 1539086175830
    },
  • "clientInfo": {},
  • "id": "ee1a392f-eccc-4f54-bd72-993e11ddde13",
  • "status": "COMPLETED_SCORED",
  • "quizId": "63f751bb-7a2b-4c86-bfbc-217c1104b36e",
  • "scores": [
    • {
      • "value": 248.25117341335454,
      • "model": "sandbox"
      }
    ],
  • "user": {
    • "accommodation": "Private housing",
    • "age": "20-24",
    • "education": "BSc",
    • "maritalStatus": "Single",
    • "occupation": "Self-employed"
    }
}
BACK