Reference
The API: fresh questions over HTTP
The API has two endpoints. Both return JSON.
| Endpoint | Returns |
|---|---|
GET /api/sample | Generated questions, in the same form as the dataset. |
GET /api/elements | Every element, with its types, domains, perspectives and difficulty levels. |
Sampling questions
/api/sample takes the parameters below. Leave a filter out and it is chosen at random.
element_name | Which element, for example law_of_demand |
|---|---|
type | The form of the question |
domain | The subject matter, for example finance |
tags | The perspective, for example first_person |
difficulty_level | The difficulty level within the element, from 1 (its easiest) up to its number of levels. Levels are relative to each element; without element_name, only elements that have the level are drawn from. A level out of range returns an error (400) |
n | How many questions, from 1 to 50 |
seed | Question i uses seed + i, so the same seed returns the same questions |
curl "https://steer-benchmark.cs.ubc.ca/api/sample?element_name=law_of_demand&n=1&seed=42"
Each question comes back as one row per part, with exactly the fields of the dataset:
{
"questions": [
{
"element": "law_of_demand",
"question_id": "law_of_demand/08207ad1a1f14bb2/0",
"base_id": "08207ad1a1f14bb2",
"part": 0,
"template_id": "law_of_demand/questions/1653",
"question_text": "John is analyzing the market for a particular stock. Initially, the stock is priced at 19222.79 and the quantity demanded is 6. After some time, he notices that the quantity demanded has decreased to 2. What might be the new price that led to this decrease in quantity demanded?",
"options": ["18836.16", "19721.29", "18328.52", "18763.49"],
"grading": "answer",
"correct_index": 1,
"consistency_group": null,
"consistency_rule": null,
"type": "quantity_decrease",
"domain": "finance",
"perspective": "man",
"tags": [],
"difficulty": 1,
"setting": "Consumption Decisions in Non-Strategic Environments",
"module": "Comparative Statics of Demand",
"generator": "autosteer@0.1.0+f90fd64",
"seed": 42
}
]
}question_id | Unique per part; base_id groups the parts of one question |
|---|---|
options, correct_index | The options in the order to show them, and the position of the correct one |
grading | answer for one correct option, or consistency, in which case the parts sharing a consistency_group are scored together by consistency_rule |
difficulty | The difficulty level within the element, from 1 (its easiest); not comparable across elements |
generator, seed, template_id | Together these reproduce the row exactly |
Called with no n or seed, the endpoint returns a single question in a shorter form, which this site uses for its "Generate a question" buttons.