ClassMarker has two integration options for automatically receiving Test results back to your systems/website, Webhooks or API.
You can select which option best suits your requirements, or even use both if you need:
Webhooks allow your Web developers to have Test results securely delivered to your systems/website in real time.
Example: On completion, Test results are delivered instantly.
Go to: WebHooks DocumentationAPI keys allow your Web developers to have your systems/website securely request & retrieve recent Test results periodically.
Example: Requests for new Test results can be hourly.
View API Documentation below.IN A NUTSHELL: Our API allows you to request your Quiz results from ClassMarker. You will specify a timestamp, whereby, you will be returned only Quiz results that were completed after your timestamp (See: finishedAfterTimestamp).
You can also send Quiz Access List Codes to ClassMarker via API requests, to automatically control who can access to your Quizzes.
A ClassMarker API key and API secret is required for API access.
An API key and API secret can be created under the My Account / API/Webhooks section of ClassMarker when logged in.
Request: All available Groups, Links & Tests
Retrieve a list of Group, Link & Test Names and IDs your API key has permission to access.
If for example, your API key has access to all Groups & Links, you can use this data to see when extra Groups or Links have been added.
You can either use a specific Group/Link and Test ID combination to retrieve results for a specific Test OR simply use the Recent results API calls (All Groups recent results or All Links recent results) to retrieve recent results from all Groups or Links available to your API key.
Links unique Quiz ID:
If your API key has permission, you will also receive the unique value for the quiz_id parameter. The quiz_id parameter tell ClassMarker which Exam to give. Each Link has a unique quiz_id parameter. This allow you to retrieve and give access to new Links as they are created right from your system.
Exam results are not retrieved with this call, only Group, Link & Test names and IDs available to your API key.
Response formats include: json & xml.
Request | URL |
GET | https://api.classmarker.com/v1.json?
api_key=XXXX &signature=XXXX& timestamp=XXXX |
Parameters | Value |
api_key | Your API key Example: Yt5Rtgf6Gtyokj76Gf3rHGfY9KJ0H2 |
signature | Your encrypted signature Example: d4tsE7SvEgzAKlJPFrlvAz3oe9uFQnxy |
timestamp | Current UNIX timestamp. Valid for 5 minutes. Example: 1335783600 |
Request: All Groups recent results
Retrieve a list of recent Test results from all Groups your API key has permission to access.
Request | URL |
GET | https://api.classmarker.com/v1/groups/recent_results.json?api_key=XXXX&signature=XXXX ×tamp=XXXX&finishedAfterTimestamp=XXXX |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
finishedAfterTimestamp | Only results finished after this UNIX timestamp will be returned. Example: 1339780142 IMPORTANT: This parameter is used to give you control (and responsibility) over which results you receive next (so as to not receive duplicate results). Think of this parameter as an "offset" whereby, each time you make a request, you should ensure your finishedAfterTimestamp is set to the value of the last next_finished_after_timestamp you received which is returned by ClassMarker in the request response (when results exist). This way, only results that have been completed, 'after' the last result you received from the ClassMarker API, will be returned to you. To avoid downloading the same results on multiple requests, you should either:
What if no results are received in a request? If no results are received in a request, the next_finished_after_timestamp parameter is not returned to you. So on your next request, you should use the last next_finished_after_timestamp you received. E.g. ...&finishedAfterTimestamp=1388498400. Note: Your request script should always check that the finishedAfterTimestamp you are about to use is younger than 3 months old, if not, set the finishedAfterTimestamp to 3 months old in your request, or leave it off the request completely. RULES for finishedAfterTimestamp
For Example
|
limit | (Optional): By default up to 200 results are returned. You can decrease the amount of returned results if you require but not increase. |
Request: All Links recent results
Retrieve a list of recent Test results from all Links your API key has permission to access.
Request | URL |
GET | https://api.classmarker.com/v1/links/recent_results.json?api_key=XXXX&signature=XXXX
×tamp=XXXX&finishedAfterTimestamp=XXXX |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
finishedAfterTimestamp | Only results finished after this UNIX timestamp will be returned. As above |
limit | (Optional): By default up to 200 results are returned. You can decrease the amount of returned results if you require. |
Request: Specific group / test recent results
Retrieve a list of recent test results from a specific Group and Test your API key has permission to access.
The group ID and test ID can be extracted from the Group & test request.
Request | URL |
GET | https://api.classmarker.com/v1/groups/XXXX/tests/XXXX/recent_results.json?api_key=XXXX&signature=XXXX
×tamp=XXXX&finishedAfterTimestamp=XXXX |
groups/29765 | The group ID is set in the request path as above Example: 29765 |
tests/64776 | The test ID is set in the request path as above Example: 64776 |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
finishedAfterTimestamp | Only results finished after this UNIX timestamp will be returned. As above |
limit | (Optional): By default up to 200 results are returned. You can decrease the amount of returned results if you require. |
{ "status":"ok", "request_path":"v1/groups/29765/tests/64776/recent_results", "server_timestamp":1339782640, "finished_after_timestamp_used":1338908448, "groups":[ { "group":{ "group_id":29765, "group_name":"Internal Accounts department" } } ], "tests":[ { "test":{ "test_id":64776, "test_name":"Health and safety exam" } } ], "results":[ { "result":{ "user_id":319118, "first":"Paul", "last":"Smith", "email":"paul@example.com", "test_id":64776, "group_id":29765, "percentage":90, "points_scored":18, "points_available":20, "time_started":1339778290, "time_finished":1339781298, "status":"f", "duration":"00:50:08", "percentage_passmark":50, "passed":true, "requires_grading":"No", "give_certificate_only_when_passed":true, "certificate_url":"https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here", "certificate_serial":"CAQPYQSBSY-ZZVKJGQH-XHWMMRCHYT", "view_results_url":"https://www.classmarker.com/view/results/?required_parameters_here" } }, { "result":{ "user_id":319119, "first":"Tracy", "last":"Thompson", "email":"tracey@example.com", "test_id":64776, "group_id":29765, "percentage":95, "points_scored":19, "points_available":20, "time_started":133977830, "time_finished":133978998, "status":"f", "duration":"00:19:47", "percentage_passmark":50, "passed":true, "requires_grading":"No", "give_certificate_only_when_passed":true, "certificate_url":"https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here", "certificate_serial":"CLPPYQSBSY-ZZVKJGQH-XHWMMRDFYT", "view_results_url":"https://www.classmarker.com/view/results/?required_parameters_here" } } ], "num_results_available":2, "num_results_returned":2, "more_results_exist":false, "next_finished_after_timestamp":133978998 }
<response> <status>ok</status> <request_path>v1/groups/29765/tests/64776/recent_results</request_path> <server_timestamp>1339841380</server_timestamp> <finished_after_timestamp_used>1338908448</finished_after_timestamp_used> <groups> <group> <group_id>29765</group_id> <group_name>Internal Accounts department</group_name> </group> </groups> <tests> <test> <test_id>64776</test_id> <test_name>Health and safety exam</test_name> </test> </tests> <results> <result> <user_id>319118</user_id> <first>Paul</first> <last>Smith</last> <email>paul@example.com</email> <test_id>64776</test_id> <group_id>29765</group_id> <percentage>90</percentage> <points_scored>18</points_scored> <points_available>20</points_available> <time_started>1339778290</time_started> <time_finished>1339781298</time_finished> <status>f</status> <duration>"00:50:08</duration> <percentage_passmark>50</percentage_passmark> <passed>true</passed> <requires_grading>No</requires_grading> <give_certificate_only_when_passed>true</give_certificate_only_when_passed> <certificate_url>https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here</certificate_url> <certificate_serial>CXPWYQSBSY-ZYSVKJGQH-XHAAJUCHYT</certificate_serial> <view_results_url>https://www.classmarker.com/view/results/?required_parameters_here</view_results_url> </result> <result> <user_id>319118</user_id> <first>Tracy</first> <last>Thompson</last> <email>tracey@example.com</email> <test_id>64776</test_id> <group_id>29765</group_id> <percentage>95</percentage> <points_scored>19</points_scored> <points_available>20</points_available> <time_started>133977830</time_started> <time_finished>133978998</time_finished> <status>f</status> <duration>"00:19:47</duration> <percentage_passmark>50</percentage_passmark> <passed>true</passed> <requires_grading>No</requires_grading> <give_certificate_only_when_passed>true</give_certificate_only_when_passed> <certificate_url>https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here</certificate_url> <certificate_serial>CXPWYQSBSY-PPSVKJGQH-XHWMJUCHYT</certificate_serial> <view_results_url>https://www.classmarker.com/view/results/?required_parameters_here</view_results_url> </result> </results> <num_results_available>2</num_results_available> <num_results_returned>2</num_results_returned> <more_results_exist></more_results_exist> <next_finished_after_timestamp>1338785035</next_finished_after_timestamp> </response>
Request: Specific link / test recent results
Retrieve a list of recent Test results from a specific link and test your API key has permission to access.
The link ID and test ID can be extracted from the Group & test request.
Request | URL |
GET | https://api.classmarker.com/v1/links/XXXX/tests/XXXX/recent_results.json? api_key=XXXX&signature=XXXX×tamp=XXXX &finishedAfterTimestamp=XXXX |
links/29765 | The link ID is set in the request path as above Example: 29765 |
tests/64776 | The test ID is set in the request path as above Example: 64776 |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
finishedAfterTimestamp | Only results finished after this UNIX timestamp will be returned. As above |
limit | (Optional): By default up to 200 results are returned. You can decrease the amount of returned results if you require. |
Links Note 1: The link_url_id field is only included if it is allowed in the API Key permissions when the API Key is Created or Edited.
Example: URL to start or resume a Link Test: https://www.classmarker.com/online-test/start/?quiz=link_url_id
link_url_id is not included by default.
Links Note 2: The access_list_id is only included if an Access List is currently assigned to the Link.
{ "status":"ok", "request_path":"v1/links/38676/tests/48756/recent_results", "server_timestamp":1339838367, "finished_after_timestamp_used":1338908448, "links":[ { "link":{ "link_name":"New York Sales Staff", "link_id":38676, "link_url_id":"g6v533a63444719ce32", "access_list_id":123456 } } ], "tests":[ { "test":{ "test_name":"Product specials and discounts quiz", "test_id":"48756" } } ], "results":[ { "result":{ "first":"Mary", "last":"Simmons", "test_id":48756, "link_id":38676, "percentage":70, "points_scored":28, "points_available":40, "time_started":1339836668, "time_finished":1339836849, "status":"f", "email":"mary@example.com", "access_code":"abc123", "extra_info":"Demographic answer 1", "extra_info2":"Demographic answer 2", "extra_info3":"Demographic answer 3", "extra_info4":"Demographic answer 4", "extra_info5":"Demographic answer 5", "duration":"00:02:41", "percentage_passmark":50, "passed":true, "requires_grading":"No", "link_result_id":22453, "cm_user_id":"abc74524", "ip_address":"192.0.43.10", "give_certificate_only_when_passed":true, "certificate_url":"https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here", "certificate_serial":"CLKPYQSBSY-ZZVKJGQH-XHWMMRCHYT", "view_results_url":"https://www.classmarker.com/view/results/?required_parameters_here" } }, { "result":{ "first":"Gary", "last":"Carter", "test_id":48756, "link_id":38676, "percentage":81, "points_scored":32.4, "points_available":40, "time_started":1339836668, "time_finished":1339836849, "status":"f", "email":"mary@example.com", "access_code":"abc123", "extra_info":"Demographic answer 1", "extra_info2":"Demographic answer 2", "extra_info3":"Demographic answer 3", "extra_info4":"Demographic answer 4", "extra_info5":"Demographic answer 5", "duration":"00:02:41", "percentage_passmark":50, "passed":true, "requires_grading":"No", "link_result_id":22463, "cm_user_id":"ttr45613", "ip_address":"192.0.43.10", "give_certificate_only_when_passed":true, "certificate_url":"https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here", "certificate_serial":"CZZPYQSBSY-ZZVKJGQH-XHWMMRCHYT", "view_results_url":"https://www.classmarker.com/view/results/?required_parameters_here" } } ], "num_results_available":2, "num_results_returned":2, "more_results_exist":false, "next_finished_after_timestamp":1339836709 }
Links Note 1: The link_url_id field is only included if it is allowed in the API Key permissions when the API Key is Created or Edited.
Example: URL to start or resume a Link Test: https://www.classmarker.com/online-test/start/?quiz=link_url_id
link_url_id is not included by default.
Links Note 2: The access_list_id is only included if an Access List is currently assigned to the Link.
<response> <status>ok</status> <request_path>v1/links/38676/tests/48756/recent_results</request_path> <server_timestamp>1339782640</server_timestamp> <finished_after_timestamp_used>1338908448</finished_after_timestamp_used> <links> <link> <link_name>New York Sales Staff</link_name> <link_id>2343765</link_id> <link_url_id>g6v533a63444719ce32</link_url_id> <access_list_id>123456</access_list_id> </link> </links> <tests> <test> <test_name>Product specials and discounts quiz</test_name> <test_id>48756</test_id> </test> </tests> <results> <result> <first>Mary</first> <last>Simmons</last> <test_id>48756</test_id> <link_id>2343765</link_id> <percentage>70</percentage> <points_scored>28</points_scored> <points_available>40</points_available> <time_started>1339775290</time_started> <time_finished>1339776622</time_finished> <status>f</status> <email>mary@example.com</email> <access_code>abc123</access_code> <extra_info>Demographic answer 1</extra_info> <extra_info2>Demographic answer 2</extra_info2> <extra_info3>Demographic answer 3</extra_info3> <extra_info4>Demographic answer 4</extra_info4> <extra_info5>Demographic answer 5</extra_info5> <duration>00:22:20</duration> <percentage_passmark>50</percentage_passmark> <passed>true</passed> <requires_grading>No</requires_grading> <link_result_id>22453</link_result_id> <cm_user_id>abc74524</cm_user_id> <ip_address>192.0.43.10</ip_address> <give_certificate_only_when_passed>true</give_certificate_only_when_passed> <certificate_url>https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here</certificate_url> <certificate_serial>CXPPOLSBSY-ZYSVKJGQH-XHWMJUCHYT</certificate_serial> <view_results_url>https://www.classmarker.com/view/results/?required_parameters_here</view_results_url> </result> <result> <first>Gary</first> <last>Carter</last> <test_id>48756</test_id> <link_id>2343765</link_id> <percentage>80</percentage> <points_scored>32</points_scored> <points_available>40</points_available> <time_started>1339776290</time_started> <time_finished>1339776822</time_finished> <status>f</status> <email>gary@example.com</email> <access_code>abc123</access_code> <extra_info>Demographic answer 1</extra_info> <extra_info2>Demographic answer 2</extra_info2> <extra_info3>Demographic answer 3</extra_info3> <extra_info4>Demographic answer 4</extra_info4> <extra_info5>Demographic answer 5</extra_info5> <duration>00:09:26</duration> <percentage_passmark>50</percentage_passmark> <passed>true</passed> <requires_grading>No</requires_grading> <link_result_id>22453</link_result_id> <cm_user_id>ttr45613</cm_user_id> <ip_address>192.0.43.10</ip_address> <give_certificate_only_when_passed>true</give_certificate_only_when_passed> <certificate_url>https://www.classmarker.com/pdf/certificate/SampleCertificate.pdf?required_parameters_here</certificate_url> <certificate_serial>CXPWYQSBSY-ZYSVKJGQH-JJHYJUCHYT</certificate_serial> <view_results_url>https://www.classmarker.com/view/results/?required_parameters_here</view_results_url> </result> </results> <num_results_available>2</num_results_available> <num_results_returned>2</num_results_returned> <more_results_exist/> <next_finished_after_timestamp>1339776622</next_finished_after_timestamp> </response>
Request: Add Access codes
Post one or more Access codes to an Access list.
Each Link can have one Access list assigned to it.
Find your specific Access List numeric ID from either:
A maximum of 100 Codes can be Added per request.
Maximum of 20,000 Access codes of up to 255 characters per Access list allowed.
API Rate Limits do not apply when adding or removing Access codes.
Request | URL |
POST | https://api.classmarker.com/v1/accesslists/123456.json?api_key=XXXX&signature=XXXX×tamp=XXXX |
accesslists/123456 | The Access List "ID" (Not Name) is set in the request path as above Example: 123456 |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
Request Body String | ["Code1","Code2","Code3","Code4"] (This is a JSON Encoded Array of Access Codes to Add) |
{ "status": "ok", "request_path": "v1/accesslists/123456", "server_timestamp": 1335783600, "access_lists": { "access_list": { "access_list_id": 123456, "access_list_name": "New York Staff", "num_codes_added": 4, "num_codes_total": 16 } } }
Links Note 1: The link_url_id field is only included if it is allowed in the API Key permissions when the API Key is Created or Edited.
Example: URL to start or resume a Link Test: https://www.classmarker.com/online-test/start/?quiz=link_url_id
link_url_id is not included by default.
Links Note 2: The access_list_id is only included if an Access List is currently assigned to the Link.
<response> <status>ok</status> <request_path>v1/accesslists/123456</request_path> <server_timestamp>1335783600</server_timestamp> <access_lists> <access_list> <access_list_id>123456</access_list_id> <access_list_name>New York Staff</access_list_name> <num_codes_added>4</num_codes_added> <num_codes_total>16</num_codes_total> </access_list> </access_lists> </response>
Code Examples: View PHP Code examples for Adding and Removing Access codes.
You have the option to add Access Codes to the Quiz Start URLs.
This means you do not need to give each Test taker an Access code, instead, you can have their unique Access code appended to the Start URL to give them access.
https://www.classmarker.com/online-test/start?quiz={QUIZ_ID}
&cm_fn=John (optional)
&cm_ln=Smith (optional)
&cm_e=john@example.com (optional)
&cm_access_list_item=their_access_code (optional)
See: View Integration overview documentation for more details.
Request: Remove Access codes
Post one or more Access codes to an Access list.
Each Link can have one Access list assigned to it.
Find your specific Access List numeric ID from either:
A maximum of 100 Codes can be Removed per request.
API Rate Limits do not apply when adding or removing Access codes.
Request | URL |
DELETE | https://api.classmarker.com/v1/accesslists/123456.json?api_key=XXXX&signature=XXXX×tamp=XXXX |
accesslists/123456 | The Access List "ID" (Not Name) is set in the request path as above Example: 123456 |
Parameters | Value |
api_key | As above |
signature | How to create a signature |
timestamp | As above |
Request Body String | ["Code1","Code2","Code3","Code4"] (This is a JSON Encoded Array of Access Codes to Remove) |
{ "status": "ok", "request_path": "v1/accesslists/123456", "server_timestamp": 1335783600, "access_lists": { "access_list": { "access_list_id": 123456, "access_list_name": "New York Staff", "num_codes_deleted": 4, "num_codes_total": 16 } } }
Links Note 1: The link_url_id field is only included if it is allowed in the API Key permissions when the API Key is Created or Edited.
Example: URL to start or resume a Link Test: https://www.classmarker.com/online-test/start/?quiz=link_url_id
link_url_id is not included by default.
Links Note 2: The access_list_id is only included if an Access List is currently assigned to the Link.
<response> <status>ok</status> <request_path>v1/accesslists/123456</request_path> <server_timestamp>1335783600</server_timestamp> <access_lists> <access_list> <access_list_id>123456</access_list_id> <access_list_name>New York Staff</access_list_name> <num_codes_deleted>4</num_codes_deleted> <num_codes_total>16</num_codes_total> </access_list> </access_lists> </response>
Code Examples: View PHP Code examples for Adding and Removing Access codes.
ClassMarker's API requires authorization with each request.
Each API request should contain an api_key, signature and timestamp. It is recommended to use a finishedAfterTimestamp parameter to download only results taken since your last request.
Each request should create a new signature and timestamp using the following method.
PHP Code Example:
Note: The periods (.) in the "$signature" MD5 example below are PHP concatenation operators.
<?php $your_api_key = 'd4tsE7SvEgzAKlJPFrlvAz3oe9uFQnxy'; $your_api_secret = 'keepThisSecret'; $current_unix_timestamp = time(); $signature = md5($your_api_key . $your_api_secret . $current_unix_timestamp); ?>
Where:
https://api.classmarker.com/v1.json?api_key=$your_api_key&signature=$signature
×tamp=$current_unix_timestamp
Note:
The md5() signature hash should be created in lowercase.
Give access to colleagues who need to review Formatted Test Results (including Questions and Answers) without them needing a ClassMarker account..
See parameter: view_results_url
Including this URL is optional and needs to be turned on in the API settings pages. Each URL is unique and unguessable.
IMPORTANT: Allow Viewing Access to: view_results_url
Access Control options include:
Download our: Quiz API Integration Guide for your Web developers.
ClassMarker administrators have the opportunity to assign (distribute) exams in two ways:
Learn More: Giving access to exams.
When retrieving Exam results from ClassMarker's API, results are returned from their respective Groups or Links depending on how they were taken. To retrieve results for a particular Exam, your API key must have access to the Group or Link the Exam is in.
The ClassMarker API is built to allow developers to download and store results in their own databases. (See PHP Code examples for PHP class and scripts, including database table schemas to help get you started or as a guide for coding in other languages).
Each API key can make up to 30 requests per hour.
As Tests are generally not taken around the clock, we recommend running a cron to request "recent results" once an hour (on a random minute of your choice).
If you receive a rate limit, the next_request_after value (see example responses below) gives you a timestamp for when you are next allowed to make a request. The next_request_after timestamp will be within one hour.
Response formats include: json & xml.
Select which format to return by using .json or .xml at the end of your request URLs.
See examples of URLs and response formats on this page.
The codes below are be used to check the response status / error codes / and if more results exist so you can make subsequent API calls.
Checking the return status value is the first thing your application should check.
You can see the status node and other response formats throughout examples on this page.
status | The three status responses you can receive are:
|
request_path | The request path you requested - useful for debugging.
Example: v1/groups/29765/tests/64776/recent_results.json |
server_timestamp | ClassMarker's server timestamp - useful for keeping in sync with our 5 minute timestamp allowance.
Example: 1339779290 |
finished_after_timestamp_used | This is the finishedAfterTimestamp you sent ClassMarker with your request - useful for debugging.
Example: 1335783600 |
num_results_available | The number of available results ClassMarker found in total.
Example: 45 |
num_results_returned | The number of results returned in this response (Maximum and Default returned results per request is 200). Use the Limit parameter in your request to modify. Example: 45 |
more_results_exist | More results will be returned if you make another request using the next_finished_after_timestamp value as your next request parameters finishedAfterTimestamp so as to not download the same results twice.
Example: true or false |
next_finished_after_timestamp | When making your next request, use this timestamp as your next request parameters finishedAfterTimestamp so as to not re-download the same results twice.
See finishedAfterTimestamp for more information. Example: 1339779290 |
Refer to the JSON and XML examples for the included error code formats.
..., "results":[ { "result":{ "user_id":319118, // ClassMarker 'User ID' "first":"Mary", // First name "last":"Simmons", // Last name "email":"paul@example.com", // Users email "test_id":48756, // ClassMarker 'Test ID' "group_id":29765, // ClassMarker 'Group ID' "percentage":70, // Percentage "points_scored":28, // Points Scored "points_available":40, // Points Available "time_started":1339836668, // Time Started (Unix Timestamp) "time_finished":1339836849, // Time Finished (Unix Timestamp) "status": "f", // f: Finished "duration":"00:32:41", // Test duration "requires_grading":"No", // Yes or No "view_results_url":"https://...", // Unique URL Per Test Result (Password protected) } },...]
Note: To also retrieve individuals Test Questions, User Responses & Category results, use our WebHooks option instead.
..., "results":[ { "result":{ "link_result_id":22455, // Unique 'Test Result ID' "first":"Mary", // First name "last":"Simmons", // Last name "email":"mary@example.com", // Users email "test_id":48756, // ClassMarker 'Test ID' "link_id":38676, // ClassMarker 'Link ID' "percentage":70, // Percentage "points_scored":28, // Points Scored "points_available":40, // Points Available "time_started":1339836668, // Time Started (Unix Timestamp) "time_finished":1339836849, // Time Finished (Unix Timestamp) "status": "f", // f: Finished Finished "access_code":"abc123", // Access code used to access test "extra_info":"Demographic answer 1", // Users answer 1 "extra_info2":"Demographic answer 2", // Users answer 2 "extra_info3":"Demographic answer 3", // Users answer 3 "extra_info4":"Demographic answer 4", // Users answer 4 "extra_info5":"Demographic answer 5", // Users answer 5 "duration":"00:02:41", // Test duration "requires_grading":"No", // Yes or No "cm_user_id":"abc74524", // cm_user_id Parameter value "ip_address":"192.0.43.10", // Users IP address "view_results_url":"https://...", // Unique URL Per Test Result (Password protected) } },...]
Note: To also retrieve individuals Test Questions, User Responses & Category results, use our WebHooks option instead.
All ClassMarker's requests return a HTTP 200 Success header even if an API system error occurs such as the errors listed below.
Standard HTTP 404, 500 series error messages will return as normal if applicable.
Look for error messages as described below to handle accordingly.
Key | Value |
apiKeyAuthFail | Access denied. Your API key authorization failed. Check your API key and API SECRET and try again. |
apiKeyInactive | Access denied. Your API key authorization is currently not active. Check with the person in charge of the your API key to check the keys active state or its start and finish active dates. |
apiKeyNoGroupPermission | Access denied. Your API key does not have permission to access the group id. |
incorrectUrl | The requested URL you have tried to access does not exist. Please refer to https://www.classmarker.com/online-testing/docs/ for more information. Some issues could be: Incorrect URL, Incorrect ID used, Incorrect HTTP METHOD used. |
incorrectUrlVersionNumber | The requested URL version number is incorrect or missing. Please refer to https://www.classmarker.com/online-testing/docs/ for more information. |
incorrectUrlId | A requested URL ID is incorrect or missing. Please refer to https://www.classmarker.com/online-testing/docs/ for more information. |
incorrectRequestMethod | The request Method: GET is incorrect for this action. Please refer to https://www.classmarker.com/online-testing/docs/ for more information. |
rateLimitExceeded | You have reached the rate limit of 30 requests per hour. You can next make a request after the UNIX epoch timestamp value set in: next_request_after |
timeStampOutOfRange | Access denied. Timestamp issue. Recalculate the digital signature with each call. (There is a 5-minute window of time variance allowed.) Use seconds since the UNIX Epoch, not milliseconds. Make sure your server calling our service is in sync with an atomic clock. |
finishedAfterTimestampTooEarly | Your finishedAfterTimestamp is too early. It can only be within the last 3 months. Contact Us to activate a 7 day period to download all your results. |
offlineMaintenance | Access denied. ClassMarker is currently down for maintenance. Check https://www.classmarker.com/msg/ for more details |
noApiKeyExists | Access denied. No API key exists. |
accountNotUpgraded | Access denied. The ClassMarker account is not currently upgraded. Upgrade for API access. |
internalError100 | Internal error. Contact ClassMarker with API Error code 100 if error persists. |
internalError101 | Internal database error. Contact ClassMarker with API Error code 101 if error persists. |
invalidJson | Invalid JSON. Please check your payload |
NotAllowedActionForQuestionType | This operation is not supported this question type |
payloadValidationError | The payload has invalid data. |
requestParamValidationError | the request parameter has invalid data |
custom_error | A custom message will display applicable to the action taken. |
This is working PHP code ready to install and start making requests and save exam results from ClassMarker to your own database. Just add your API credentials.
Our code GitHub sample code currently only includes PHP code examples, however these can be used as a guide for coding in other languages.
Quiz Maker API code from Github
Included files:
This PHP code can be used to Add or Remove access codes from your access lists.
Fill in your API Key and Secret and Access list ID, and add your array of Access codes to add or delete as required.
<?php // PHP API Access Lists code example by ClassMarker.com $your_api_key = 'yourApiKey'; $your_api_secret = 'keepThisSecret'; $current_unix_timestamp = time(); $signature = md5($your_api_key . $your_api_secret . $current_unix_timestamp); // Create Access Codes Array $access_codes_array = array('Code1', 'Code2', 'Code3', 'Code4'); // Convert to JSON string $json_string_payload = json_encode($access_codes_array); // Which Access list to update $your_access_list_id = 123456; // Adding Codes $method = 'POST'; // Removing Codes // $method = 'DELETE'; $request_baseurl = 'https://api.classmarker.com/v1/accesslists/' . $your_access_list_id . '.json?api_key='.$your_api_key . '&signature=' . $signature . '×tamp=' . $current_unix_timestamp; // create curl resource $ch = curl_init(); // set url curl_setopt($ch, CURLOPT_URL, $request_baseurl); $headers = array( 'Content-type: application/json; charset=utf-8' ); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $method); // REQUEST METHOD MUST BE POST OR DELETE curl_setopt($ch, CURLOPT_POSTFIELDS, $json_string_payload); // Catch JSON Response String from ClassMarker $json_response_string = curl_exec($ch); // close curl resource to free up system resources curl_close($ch); ?>
When testing with our Links option, you can pass your Test takers data such as their Name, Email or their user_id from your system.
This data is saved in ClassMarker and returned with respective results via this API.
This makes passing Test takers tracking details to ClassMarker easy to reference exam results back in your system.
More about Integrating your online testing