Quiz
Last updated
Last updated
GET
‎https://<domain>/<api prefix>/<version>/quiz/list/
This API endpoint will return a list of the available quiz.
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
HTTP/1.1 200 OK
Content-Type: application/json
Body:
{
"status_code": 200,
"errors": {},
"data": {
"results": [
{
"slug": "<quiz_slug>",
"name": "<quiz_name>",
"question_count": <question_count>,
"description": "<description>",
"quiz_details": {
"name": "<name>",
"maximum_questions": <maximum_questions>,
"quiz_duration": "<quiz_duration>",
"total_score": <total_score>,
"badge": "<badge>",
"description": "<description>",
"rules": "<rules>"
}
}
...
],
"count": <list_count>,
"previous": <previous_page_url>,
"next": <next_page_url>
}
}
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/quiz/list/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/quiz/list/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
GET
‎https://<domain>/<api prefix>/<version>/quiz/list/results/
This API endpoint will return a list of quiz summary list with details.
HTTP/1.1 200 OK
Content-Type: application/json
Body:
{
"status_code": 200,
"errors": {},
"data": {
"results": [
{
"score": <score>,
"total_score": <total_score>,
"reward": <reward>,
"last_attempt": "<last_attempt>",
"attempts": <attempts>,
"name": "<name>",
"status": "<status>",
"badge": {
"name": "<badg-name>",
"image": "<image>",
"slug": "<slug>"
},
"related_courses": [
{
"id": <id>,
"slug": "<slug>",
"title": "<title>",
"thumbnail": "<thumbnail>",
"short_description": "<short_description>",
"long_description": "<long_description>",
"detail_url": "<detail_url>",
"authors": [
{
"name": "<author_name>"
}
],
"duration": "<duration>",
"progress": <progress>,
"skills": [
"<skills>"
],
"price": <price>,
"converted_price": "<converted_price>",
"course_type": "<course_type>",
"total_reviews": "<total_reviews>"
},
...
]
},
...
],
"count": <list_count>,
"previous": <previous_page_url>,
"next": <next_page_url>
}
}
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/quiz/list/results/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/quiz/list/results/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
GET
‎https://<domain>/<api prefix>/<version>/quiz/start/
This API endpoint will start a quiz and return all the questions and options of the quiz.
HTTP/1.1 200 OK
Content-Type: application/json
Body:
{
"status_code": 200,
"errors": {},
"data": {
"questions": [
{
"id": <question_id>,
"number": <question_number>,
"question": "<question>",
"score": <score>,
"duration": "<duration>",
"options": [
{
"number": <option_number>,
"question": <question_id>,
"option": "<option>",
"answer": <is_option>
},
...
]
},
...
]
}
}
Node
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://<domain>/<api prefix>/<version>/quiz/start/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
formData: {}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/quiz/start/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
POST
‎https://<domain>/<api prefix>/<version>/quiz/submit/answer/
This API endpoint will submit answer options of all quiz questions and end the quiz.
HTTP/1.1 200 OK
Content-Type: application/json
Body:
{
"status_code": 200,
"errors": {},
"data": {}
}
Node
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://<domain>/<api prefix>/<version>/quiz/submit/answer/',
'headers': {
'apikey': '<apikey>',
'Authorization': 'Bearer <access token>',
},
body: JSON.stringify({"slug":"<course_slug>","options":[
{"id":<option_id>,"number":<option_number>,"question":<question_number>,"option":"<option>","answer":<answer>},...
]})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://<domain>/<api prefix>/<version>/quiz/submit/answer/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"slug": "<course_slug>",
"options":[
{
"id": <option_id>,
"number": <option_number>,
"question": <question_number>,
"option": "<option>",
"answer": <answer>,
},
...
]
}',
CURLOPT_HTTPHEADER => array(
'apikey: <apikey>',
'Authorization: Bearer <access token>',
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|