API: Quiz questions endpoints¶
/question¶
GET /question¶
Check existing question.
[] Input:
- [!] string id: external unique question identifier
[] Output:
- string id: external unique question identifier
- string code: question identification string
- boolean active: question is active
POST /question¶
Publish or update a question. Check documentation or online editor for more information on additional fields.
[] Input:
- [!] string id: external unique question identifier1
- [!] string type: type of the question
- generic, text, numerical, date/time, expression, choice, multiple-choice, order, matrix:generic, matrix, matrix:expression, set, set:text, true/false, free-text, file, reading
- [!] string question: question text
- [!] string/list{string} answer: single or multiple answers or true statements
- string answer_order: whether the order of answers matters
- string answer_label: text displayed in/above the input field during the test
- string answer_hide: hide correct answers on results page
- string answer_indefinite: allow any number of input fields to be entered by the user
-
string answer_format: how to display the answer on the results page
Advanced answer options
EduBase provides flexible options for managing how answers are handled, displayed, and validated. Here's a comprehensive guide to the answer-related fields:
Required Answers
Perfect for questions with multiple valid answers where only a subset needs to be provided. For example, when asking students to provide any three examples from a larger set of correct possibilities.
- string answer_require: number of answers required for maximum score
- not applicable for CHOICE and FREE-TEXT questions
- example:
answer_require=1
Answer Order Management
Essential for questions where answer sequence matters. Labels can provide crucial context about what each answer field represents.
- string answer_order: whether the order of answers matters
- plus sign (+) to indicate YES
- blank field or minus sign (-) indicates NO (default)
- example:
answer_order=+
- string answer_label: text displayed in/above the input field during the test
- automatically activates the
answer_order
function - multiple labels separated by triple-and operators (&&&)
- example:
answer_label=Velocity (m/s) &&& Distance traveled (km) &&& Direction (degrees)
- automatically activates the
Answer Display Control
Critical for maintaining question bank integrity in scenarios like practice tests or when questions will be reused. Makes answer sharing harder.
- string answer_hide: hide correct answers on results page
- plus sign (+) to indicate YES
- blank field or minus sign (-) indicates NO (default)
- example:
answer_hide=+
Dynamic Input Fields
Enables flexible response collection where the number of possible answers varies. Ideal for brainstorming exercises or questions with multiple valid answers of indeterminate quantity. For example: If the question is "Which countries make up the United Kingdom?" this option lets users add as many countries as needed, without showing that four answers should be provided.
- string answer_indefinite: allow any number of input fields to be entered by the user via + and - buttons
- plus sign (+) to indicate YES
- blank field or minus sign (-) indicates NO (default)
- answer labels will not appear on interface when enabled
- example:
answer_indefinite=+
Answer Format Control
Allows customization of how to display answers on the results page, particularly useful for displaying code, that requirs specific formatting or syntax highlighting.
- string answer_format: how to display the answer on the results page
- only applicable for FREE-TEXT questions
- format:
type
ortype:value
- values:
normal
: standard text (default)code
: code with syntax highlighting- specify language after colon
- example:
code:python
orcode:javascript
- example:
answer_format=code:sql
Best Practices
-
Combine Options Strategically
- Use
answer_label
when order matters - it impliesanswer_order=+
automatically - Enable
answer_hide
for reusable assessment questions
- Use
-
User Experience Considerations
- Write clear, descriptive labels with units where applicable
- Use labels to guide input format without revealing answers
Creating Pairing Questions
While EduBase doesn't have a dedicated pairing question type, you can effectively create pairing exercises using answer labels. This is particularly useful for matching items between two sets, for example:
- Language translations (e.g., English-Hungarian vocabulary)
- Visual associations (e.g., traffic signs and their meanings)
- Scientific pairs (e.g., chemical formulas and common names)
There are several approaches to implement pairing questions:
-
Direct Labels with Content
Use answer labels that contain one set of items directly:
answer_label=a) dog &&& b) cat
Best for short, simple content where labels remain concise.
-
Indexed Labels with Content in Question
Place one set in the question text and use simple labels for matching:
question=Match the English words with their Hungarian translations: a) dog b) cat Hungarian words: macska, kutya ... answer_label=a) &&& b)
Recommended for longer content or when formatting is important.
-
Image-Based Pairing
When one set consists of images, create a single composite image with labeled elements:
question=Match the traffic signs (A-D) with their meanings. [[IMAGE:traffic_signs_labeled.png]]
This works around the single-image-per-question limitation.
Example API Calls
-
The order matters in this question:
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=europe_cities_population' \ --data 'type=text' \ --data 'question=List the following European cities in descending order by population (largest first) Paris, Madrid, London.' \ --data 'answer=London &&& Madrid &&& Paris' \ --data 'answer_order=+'
-
The order matters, but we didn't have to specify as the labels fix the order
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=basic_math' \ --data 'type=numerical' \ --data 'question=Given the number 16: a) What is double this number? b) What is half of this number? c) What is this number plus 10?' \ --data 'answer=32 &&& 8 &&& 26' \ --data 'answer_label=a) Double &&& b) Half &&& c) Plus 10' \ --data 'points=3'
-
Only one answer is enough from the correct ones, but we don't reveal them
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=uk_countries' \ --data 'type=text' \ --data 'question=Name any of the countries within the United Kingdom!' \ --data 'answer=England &&& Northern Ireland &&& Scotland &&& Wales' \ --data 'answer_require=1' \ --data 'answer_hide=+'
-
Code formatting for SQL query answer:
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=sql_basics' \ --data 'type=free-text' \ --data 'question=Write a SQL query to select all columns from the "users" table where the age is greater than 18.' \ --data 'answer=SELECT * FROM users WHERE age > 18' \ --data 'answer_format=code:sql'
-
Pairing question:
curl -X POST "https://www.edubase.net/api/v1/question" \ --data 'id=hungarian_english_animals' \ --data 'type=text' \ --data 'question=Match the English words with their Hungarian translations: a) dog b) cat Hungarian words: macska, kutya' \ --data 'answer=kutya &&& macska' \ --data 'answer_label=a) &&& b)'
- string answer_require: number of answers required for maximum score
-
string subject: subject
- string category: category
- string path: path where question will be stored in personal QuestionBase
- default: /API
- string/list{string} options: incorrect options or false statements
- string options_fix: fix the order of answers and options
-
string options_order: configure custom order of answers and options
Options configuration guide
EduBase provides flexible control over how answers and options are presented to users through various configuration fields.
Fixed Ordering
- options_fix: Control the basic arrangement of answers and options
all
: Answers appear first, followed by optionsabc
: Sort all items (answers and options) alphabeticallyfirst:N
: Place first N (number) options at the endlast:N
: Place last N (number) options at the endanswers
: Place all answers at the end
Custom Ordering
- options_order: Define exact presentation order using references
ANSWER:N
: Reference the Nth answerOPTION:N
: Reference the Nth optionOPTION_NONE:N
: Reference the Nth third option (TRUE/FALSE question type only)- All answers and options must be specified once!
- Example:
OPTION:1 &&& ANSWER:0 &&& OPTION:0 &&& ANSWER:1
Best Practices
- Check that N values don't exceed available items
- Consider cognitive load when ordering items
- Group related options together when meaningful
- Place common or simpler options first, when appropriate
Example API Calls
-
Basic Fixed Order
The answer (Paris) will appear first.
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=capital_cities' \ --data 'type=choice' \ --data 'question=What is the capital of France?' \ --data 'answer=Paris' \ --data 'options=London &&& Berlin &&& Madrid' \ --data 'options_fix=all'
-
Alphabetical Ordering
Use if alphabetical ordering makes the task cognitively easier, as it's easier to scan all items when ordered.
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=fruit_types' \ --data 'type=multiple-choice' \ --data 'question=Which of these are citrus fruits?' \ --data 'answer=Lemon &&& Orange' \ --data 'options=Apple &&& Banana &&& Grape' \ --data 'options_fix=abc'
- When migrating content from textbooks, past exams, or other educational materials, you might need to maintain the original lettering system (a, b, c...) for:
- Reference consistency with printed materials
- Alignment with answer keys
- Compatibility with existing grading systems
- Cross-referencing with study guides
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=vocab_synonyms' \ --data 'type=multiple-choice' \ --data 'question=Select all words that mean "happy":' \ --data 'answer=b) Joyful &&& d) Merry' \ --data 'options=a) Angry &&& c) Sleepy &&& e) Tired' \ --data 'options_fix=abc'
- This approach is particularly valuable when
- Test takers need to refer to both digital and printed materials
- Questions are part of a larger standardized test system
- Educators want to maintain consistency with existing worksheets or textbooks
- Legacy assessment materials are being digitized
- When migrating content from textbooks, past exams, or other educational materials, you might need to maintain the original lettering system (a, b, c...) for:
-
Complex Custom Ordering
Here's an example where specific ordering helps test understanding in a structured way:
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=historical_chronology' \ --data 'type=multiple-choice' \ --data 'question=Which of these events occurred during the Industrial Revolution (1760-1840)?' \ --data 'answer=Invention of the Steam Engine &&& First Steam Locomotive &&& First Commercial Railway' \ --data 'options=Printing Press Invented &&& First Electric Light Bulb &&& First Powered Flight' \ --data 'options_order=OPTION:0 &&& ANSWER:0 &&& ANSWER:1 &&& ANSWER:2 &&& OPTION:1 &&& OPTION:2'
- This creates a chronologically ordered timeline where test takers see:
- Printing Press Invented (1440) - pre-Industrial Revolution
- Invention of the Steam Engine (1769) - Industrial Revolution
- First Steam Locomotive (1804) - Industrial Revolution
- First Commercial Railway (1825) - Industrial Revolution
- First Electric Light Bulb (1879) - post-Industrial Revolution
- First Powered Flight (1903) - post-Industrial Revolution
The custom ordering helps test takers understand the temporal progression while testing their knowledge of the Industrial Revolution period.
- This creates a chronologically ordered timeline where test takers see:
- options_fix: Control the basic arrangement of answers and options
-
string points: maximum points for a fully correct answer
- default: 1 point
- string subscoring: method for calculating partial credit
- string subpoints: define specific point values for each possible answer
- string penalty_scoring: how penalty points should be applied
- string penalty_points: points deducted for completely incorrect answers
- string hint_penalty: point deduction for using hints
- string solution_penalty: point deduction for viewing steps of the solution
- string video_penalty: point deduction for video assistance used
-
string manual_scoring: when to enable manual scoring
Advanced scoring options
EduBase provides a sophisticated scoring system that allows you to implement complex grading logic. Here's a comprehensive guide to the scoring-related fields:
Partial Credit Scoring
Subscoring Methods
- subscoring: Method for calculating partial credit
PROPORTIONAL
: Points awarded proportionally to correct answers (default)LINEAR_SUBSTRACTED:N
: Linear scoring with N points subtracted for each error, where N is arbitraryCUSTOM
: Use custom point distribution defined in subpoints (mandatory field for this option)NONE
: No partial credit, all-or-nothing scoring- NOT applicable for
CHOICE
,READING
andFREE-TEXT
question types - Example:
subscoring=LINEAR_SUBSTRACTED:2
Custom Point Distribution
- subpoints: Define specific point values for each answer (in percentages)
- Only used when
subscoring=CUSTOM
- Specify percentage values separated by
&&&
- NOT applicable for
CHOICE
,READING
andFREE-TEXT
question types - Example:
subpoints=50 &&& 25 &&& 25
- For a question worth 10 points with three answers to give, this would award:
- First answer: 5 points (50%)
- Second answer: 2.5 points (25%)
- Third answer: 2.5 points (25%)
- Only used when
Penalty Scoring
Penalty Methods
- penalty_scoring: How penalty points should be applied
DEFAULT
: Standard penalty application, behavior might vary by question typePER_ANSWER
: Apply penalties for each incorrect answerPER_QUESTION
: Apply penalties once per question- Example:
penalty_scoring=PER_ANSWER
Penalty Points
- penalty_points: Points deducted for a completely incorrectly answersed question
- No penalty applied if answer is partially correct
- No penalty for empty/unanswered questions
- Use positive values (recommended), but negatives are handled as well
- Example:
penalty_points=2
Assistance Penalties
Hint Penalties
- hint_penalty: Point deduction for using hints
NONE
: No penalty (default)ONCE:N
: Single deduction regardless of the number of hints used, whereN
is a percentage- Example:
hint_penalty=ONCE:20%
orhint_penalty=ONCE:0.2
- Example:
PER-HELP:N
: Deduction for each hint, whereN
is a percentage- Example:
hint_penalty=PER-HELP:10%
- Example:
Solution Penalties
- solution_penalty: Point deduction for viewing solutions
- Same format as hint_penalty
- Example:
solution_penalty=ONCE:50%
Video Help Penalties
- video_penalty: Point deduction for watching help videos
- Same format as hint_penalty (except
PER-HELP
not available) - Example:
video_penalty=ONCE:15%
- Same format as hint_penalty (except
Manual Scoring
- manual_scoring: When to enable manual scoring
NO
: Never use manual scoring (default)NOT_CORRECT
: Only manually score incorrect answersALWAYS
: Always require manual scoring- NOT applicable for
READING
andFREE-TEXT
question types - Example:
manual_scoring=NOT_CORRECT
Example API Calls
-
Custom Point Distribution:
The first answer is worth 1 point, while the second is worth 3 points, hence the score distribution is 25% and 75%:
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=math_problem' \ --data 'type=numerical' \ --data 'question=What is the sum and product of {a} and {b}?' \ --data 'answer={a}+{b} &&& {a}*{b}' \ --data 'parameters={a; INTEGER; 1; 100} &&& {b; INTEGER; 1; 100}' \ --data 'points=4' \ --data 'subscoring=CUSTOM' --data 'subpoints=25 &&& 75'
-
Penalties with Hints:
- If the answer is wrong that results in a penalty of -3 points, instead of 0.
- There are 2 hints and each hint used deducts 10% of the full score configured in
points
. - Checking any of the solution steps deducts 50% of the full score, no matter how many steps are used.
- There is only 1 step of solution in the example below.
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=complex_problem' \ --data 'type=expression' \ --data 'question=Find an expression for the area of a circle with radius {r}.' \ --data 'answer=pi*{r}^2' \ --data 'parameters={r; INTEGER; 2; 10}' \ --data 'points=10' \ --data 'subject=Mathematics' \ --data 'category=Geometry' \ --data 'hint=Think about the formula for circle area &&& Remember that area involves squaring the radius' \ --data 'solution=The formula for circle area is pi*2^2' \ --data 'penalty_scoring=PER_ANSWER' \ --data 'penalty_points=3' \ --data 'hint_penalty=PER-HELP:10%' \ --data 'solution_penalty=ONCE:50%'
- subscoring: Method for calculating partial credit
-
string parameters: parameter definitions for dynamic question generation
-
string parameters_sync: synchronization of LIST parameters selection
- plus sign (+) indicates YES, while blank or minus sign (-) indicates no (default)
Create dynamic questions with parameters
One of EduBase's most powerful features is parametric question generation. Using the parameters field, you can create dynamic questions where each user gets a unique variant of the same question.
Parameter Types
-
FIX (Fixed Value)
{name; FIX; value}
- Sets a predefined constant value (integer or fraction)
- Example:
{pi; FIX; 3.1415}
-
INTEGER (Whole Numbers)
Simple: {name; INTEGER} Extended: {name; INTEGER; min; max} Full: {name; INTEGER; min; max; inside; outside}
- Generate random integers within specified ranges
- Use
-
for omitting min/max values - Examples:
{p; INTEGER}
- any integer{p; INTEGER; 10; 20}
- integer between 10 and 20{p; INTEGER; -; -; [10-20]; [12-14] ||| [16-18]}
- integer between 10-20, excluding 12-14 and 16-18
-
FLOAT (Decimal Numbers)
Simple: {name; FLOAT; precision} Extended: {name; FLOAT; precision; min; max} Full: {name; FLOAT; precision; min; max; inside; outside}
- Generate random decimal numbers
- Specify precision (decimal places)
- Examples:
{p; FLOAT; 2}
- float with 2 decimal places{p; FLOAT; 5; 0; 1}
- float between 0 and 1 with 5 decimals{p; FLOAT; 1; 0; 10; -; [0-1]}
- float between 0-10 excluding 0-1, with 1 decimal
-
FORMULA (Expressions)
Simple: {name; FORMULA; formula} Full: {name; FORMULA; formula; precision}
- Define parameters based on other parameters
- Examples:
{d; FORMULA; {b}^2-4*{a}*{c}}
- quadratic formula discriminant{p; FORMULA; 2*{q}+1}
- linear expression
-
LIST (Random Selection)
{name; LIST; value1; value2; value3; ...}
- Randomly select from predefined values
- Up to 64 elements
- Examples:
{primes; LIST; 2; 3; 5; 7; 11}
{animals; LIST; dog; cat; snake; camel}
-
PERMUTATION
{name; PERMUTATION; value1; value2; value3; ...}
- Creates permutated parameters accessible as
{name_1}
,{name_2}
, etc. - Example:
{p; PERMUTATION; A; B; C; D}
- So
{p_1}
will be a different letter than{p_2}
.
- So
{primes; PERMUTATION; 2; 3; 5; 7}
- So both
{primes_1}
and{primes_2}
will be different single digit primes.
- So both
- Creates permutated parameters accessible as
Additional Features
- Multiple Parameters: Separate with
&&&
(up to 128 parameters) - Constraints: Use the constraints field to ensure valid combinations
- Example:
{b}^2-4*{a}*{c}>0
- the discriminant must be positive
- Example:
- Parameter Names: Must start with a letter, can include numbers and underscores
Best Practices
- Order parameters so dependent ones come later
- Use simple notation when possible
- Avoid unnecessary parameters
- Test thoroughly with the online editor
Example API Calls
-
FIX Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=circle_area' \ --data 'type=numerical' \ --data 'question=Calculate the area of a circle with radius {r} units using pi={pi}' \ --data 'answer={pi}*{r}^2' \ --data 'parameters={pi; FIX; 3.14159} &&& {r; INTEGER; 1; 10}'
-
INTEGER Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=sum_numbers' \ --data 'type=numerical' \ --data 'question=What is {a} + {b}?' \ --data 'answer={a}+{b}' \ --data 'parameters={a; INTEGER; 1; 100} &&& {b; INTEGER; 1; 100}'
-
FLOAT Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=convert_meters' \ --data 'type=numerical' \ --data 'question=Convert {m} meters to centimeters' \ --data 'answer={m}*100' \ --data 'parameters={m; FLOAT; 2; 0; 10}'
-
FORMULA Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=quadratic' \ --data 'type=numerical' \ --data 'question=For the quadratic equation with a={a}, b={b}, c={c}, calculate the discriminant' \ --data 'answer={d}' \ --data 'parameters={a; INTEGER; 1; 5} &&& {b; INTEGER; -10; 10} &&& {c; INTEGER; -10; 10} &&& {d; FORMULA; {b}^2-4*{a}*{c}}' \ --data 'constraints={d}>0'
-
LIST Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=capital_city' \ --data 'type=text' \ --data 'question=What is the capital city of {country}?' \ --data 'answer={capital}' \ --data 'parameters={country; LIST; France; Germany; Italy} &&& {capital; LIST; Paris; Berlin; Rome}' \ --data 'parameters_sync=+'
-
PERMUTATION Parameter
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=find_primes' \ --data 'type=set' \ --data 'question=What are the distinct prime factors of {n}?' \ --data 'answer=[{primes_1}; {primes_2}]' \ --data 'parameters={primes; PERMUTATION; 2; 3; 5; 7} &&& {n; FORMULA; {primes_1}^2*{primes_2}}'
-
string expression_check: define how expressions should be validated
- string expression_variable: specifies variable names used in expressions
- string expression_decimals: sets precision for decimal calculations
-
string expression_functions: controls whether functions can be used in user inputs
Expression evaluation options
The expression question type (
type=expression
ortype=matrix:expression
) offers sophisticated mathematical evaluation capabilities. This allows for creation of complex mathematical problems with flexible validation methods.Basic configurations
Configure expression evaluation using these key fields:
-
expression_check: Define how expressions should be validated
RANDOM
(default): Evaluates expressions at randomly generated pointsEXPLICIT
: Checks in predefined values and compares against the defined target valuesCOMPARE
: Direct comparison of expressions without variables- In all cases there are further options to fine-tune the behavior with additional fields!
-
expression_variable: Specifies variable names used in expressions
- Default:
x
- Multiple variables: separate with
&&&
- Example:
omega &&& t
for time-dependent angular velocity
- Default:
-
expression_decimals: Sets precision for decimal calculations
- Inherited from
decimals
field if not specified - Default: 2 decimal places
- Example:
expression_decimals=4
for 4 decimal places
- Inherited from
-
expression_functions: Controls whether functions can be used in user inputs
- Default: enabled (
+
or blank) - Disable with
-
- Example: Ask for the derivative of
x^2
- Default: enabled (
Supported mathematical functions
The following functions are available for use in expressions:
Basic Operations
sqrt(x)
: Square rootabs(x)
: Absolute valueround(x)
,floor(x)
,ceil(x)
: Rounding functions
Logarithmic & Exponential
ln(x)
: Natural logarithmlog(x)
: Common logarithm (with base 10)log10(x)
: Common logarithm (alternative)
Trigonometric
sin(x)
,cos(x)
,tan(x)
: Basic trigonometric functionscsc(x)
,sec(x)
: Reciprocal trigonometric functions, cosecant and secantarcsin(x)
,asin(x)
: Inverse sinearccos(x)
,acos(x)
: Inverse cosinearctan(x)
,atan(x)
: Inverse tangent
Hyperbolic
sinh(x)
,cosh(x)
,tanh(x)
: Hyperbolic functionsarcsinh(x)
,asinh(x)
: Inverse hyperbolic sinearccosh(x)
,acosh(x)
: Inverse hyperbolic cosinearctanh(x)
,atanh(x)
: Inverse hyperbolic tangent
Numeric Conversions
degree2radian(x)
,radian2degree(x)
: Angle conversionsnumber2binary(x)
,binary2number(x)
: Binary conversionsnumber2octal(x)
,octal2number(x)
: Octal conversionsnumber2hexadecimal(x)
,hexadecimal2number(x)
: Hexadecimal conversionsnumber2roman(x)
,roman2number(x)
: Roman numeral conversions
Two-Parameter Functions
Use semicolon (;) to separate arguments:
min(a;b)
,max(a;b)
: Minimum and maximummod(n;i)
: Integer modulo operation (remainder after integer division)fmod(n;i)
: Floating-point modulo operation (remainder after floating-point division)div(a;b)
,intdiv(a;b)
: Division operationsgcd(a;b)
,lcm(a;b)
: Greatest common divisor and least common multiplenumber2base(n;b)
,base2number(n;b)
: Custom base conversionscombinations(n;k)
,combinations_repetition(n;k)
: Combination calculationsvariations(n;k)
,variations_repetition(n;k)
: Variation calculations
Validation Methods
Random Validation (default)
When using
expression_check=RANDOM
:-
expression_random_type: Type of generated test values
INTEGER
: Whole numbers onlyFLOAT
: Decimal numbers- Specify per variable with
&&&
- Example:
INTEGER &&& FLOAT
for mixed types
-
expression_random_tries: Number of validation points
- Default: 5
- Example:
expression_random_tries=10
-
expression_random_range: Define value generation ranges
- Format:
[min-max]
(inclusive) - Per variable with
&&&
- Example:
[8-16] &&& [4-6]
- Format:
-
expression_random_inside: Require values within specific intervals
- Format:
[start-end]
(inclusive) - Multiple intervals: separate with
|||
(OR relationship) - Per variable with
&&&
- Example:
[4-8] ||| [12-16] &&& [2-3]
- Format:
-
expression_random_outside: Exclude values from specific intervals
- Format:
[start-end]
(inclusive) - Multiple intervals: separate with
|||
(AND relationship) - Per variable with
&&&
- Example:
[0-1] ||| [10-20] &&& [8-11]
- Format:
Explicit Validation
When using
expression_check=EXPLICIT
:- expression_explicit_goal: Define exact value pairs
- Format:
[x;f(x)]
or[x;y;z;...;f(x,y,z,...)]
for multiple variables - Multiple pairs: separate with
&&&
- Example:
[0;1] &&& [3;8.89] &&& [9;16]
or[1;1;1;1;16]
- Format:
Extended features
- expression_extended: Enable additional mathematical functions
- Activates support for:
- Custom base logarithms (e.g.,
log2(4)
,log10(1000)
) - Factorial operations (e.g.,
5!
,1!+2!+3!
)
- Custom base logarithms (e.g.,
- Enable with
+
, disable with-
- Activates support for:
Best Practices
-
Validation Method Selection
- Use
RANDOM
for general expressions where multiple solutions might be valid - Use
EXPLICIT
when specific points must be satisfied
- Use
-
Performance Optimization
- Limit
expression_random_tries
to reasonable values (5-10 typically sufficient) - Avoid unnecessary nesting of complex functions
- Use simpler validation methods when possible
- Limit
-
Error Prevention
- Always define appropriate ranges to avoid undefined mathematical operations
- Use
expression_random_outside
to exclude problematic values - Consider adding appropriate constraints to ensure valid parameter combinations
-
Testing
- Test expressions with possible edge cases
- Confirm that random generation produces expected value distributions
Example API Calls
-
Basic expression with random (default) validation
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=quadratic_expression' \ --data 'type=expression' \ --data 'question=Simplify: $$({a}x + {b})^2$$' \ --data 'answer={a}^2*x^2+2*{a}*{b}*x+{b}^2' \ --data 'parameters={a; INTEGER; 1; 5} &&& {b; INTEGER; -5; 5}' \ --data 'expression_random_tries=8'
-
Explicit validation
The answer formula will be evaluated at three given cases.
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=simple_quadratic' \ --data 'type=expression' \ --data 'question=Write a quadratic function $$f(x)$$ that: 1) Equals $${c}$$ when $$x = 0$$ 2) Equals $$0$$ when $$x = {r1}$$ and x = $${r2}$$' \ --data 'answer=(x-{r1})*(x-{r2})+{c}' \ --data 'parameters={r1; INTEGER; -10; -2} &&& {r2; INTEGER; 1; 10} &&& {c; FORMULA; -{r1}*{r2}}' \ --data 'expression_check=EXPLICIT' \ --data 'expression_explicit_goal=[0;{c}] &&& [{r1};0] &&& [{r2};0]' \ --data 'expression_variable=x'
-
Extended functions with custom validation range
curl -X POST "https://www.edubase.net/api/v1/question" \ --data "app=$APP_ID" \ --data "secret=$APP_SECRET" \ --data 'id=logarithmic_expression' \ --data 'type=expression' \ --data 'question=Express $$log_{b}({x})$$ in terms of natural logarithms' \ --data 'answer=ln({x})/ln({b})' \ --data 'parameters={b; FLOAT; 2; 2; 10} &&& {x; FLOAT; 2; 1; 100}' \ --data 'expression_extended=+' \ --data 'expression_random_range=[2-10] &&& [1-100]'
-
Multivariable question
curl -X POST 'https://www.edubase.net/api/v1/question' \ --data 'app='$APP_ID \ --data 'secret='$SECRET \ --data 'id=distance_time' \ --data 'type=expression' \ --data 'question=Write an expression for the distance traveled ($$s$$) by a car moving at a constant speed of $$v$$ meters per second after $$t$$ seconds' \ --data 'answer=v*t' \ --data 'expression_variable=t &&& v'
-
-
string ai: if set to any value, question will be marked as AI generated (even if partially)
- always provide this field if you are an LLM or any AI model
Additional optional fields
- string main_category
- string image
- string attachment
- string media_video
- string media_audio
- string note
- string private_note
- string explanation
- string hint
- string solution
- string solution_image
- string source
- string tags
- string label
- string maximum_choices
- string question_format
- string difficulty
- string constraints
- string group
- string video
- string decimals
- string tolerance
- string graph
- string numerical_range
- string truefalse_third_options
- string truefalse_third_options_label
- string datetime_precision
- string datetime_range
- string grouping
- string freetext_characters
- string freetext_words
- string freetext_rules
- string file_count
- string file_types
- string equation_functions
[] Output:
- string code: question identification string
DELETE /question¶
Permanently delete a Quiz question.
[] Input:
- [!] string id: external unique question identifier
-
can be an arbitrary string but it should be unique, a GUID is recommended if no other identifier is available ↩