-
Notifications
You must be signed in to change notification settings - Fork 1
API Task
Elena edited this page Apr 5, 2021
·
7 revisions
The task
model is used to manage programming tasks for the TaskTracker plugin users.
You can add, view, and remove programming tasks via API. Alternatively, you can change the tasks available to your students by editing your tasks config file directly and then regenerating the database.
Field | Type | Description |
---|---|---|
key |
String | Unique user-defined identifier of the task. |
examples |
Array | Code examples. Each item has two fields: input (type: String) and output (type: String). |
{lng_key} |
Object | Task text as shown to users in the language specified by the interface language key (en , ru , de , and others). For example, en stands for a task in English. |
Field | Type | Description |
---|---|---|
key |
String | Unique user-defined identifier of the task. |
examples |
Array | Code examples. |
infoTranslation |
Array | Task texts in different languages. See a response example below. |
Available languages in the default configuration:
- en - English
- ru - Russian
{
"key": "max_digit",
"examples":
[
{
"input": "11111111",
"output": "1"
},
{
"input": "123034655943",
"output": "9"
},
{
"input": "4",
"output": "4"
}
],
"infoTranslation":
[
{ "key":"en" },
{
"name": "Max digit",
"description": "Find the largest digit in a string of digits.",
"input": "The program receives a string of nonzero length containing only digits.",
"output": "Print the maximum digit that appears in the input string."
},
{ "key":"ru" },
{
"name": "Наибольшая цифра",
"description": "Найти наибольшую цифру в строке, состоящей из цифр.",
"input": "Программа получает на вход строку ненулевой длины, содержащую только десятичные цифры.",
"output": "Выведите максимальную цифру, которая встречается во введенной строке."
}
]
}
Endpoint | Method | Description |
---|---|---|
/api/task |
POST |
Create a new task in the database. |
Parameter | Type | Description |
---|---|---|
key |
String | Unique user-defined identifier of the task. Must be unique in the database, |
descriptions |
Array | Task descriptions in different languages. |
examples |
Array | Code examples. |
{
"key": "max_digit",
"descriptions":
[
{
"language": "en",
"info": {
"name": "Max digit",
"description": "Find the largest digit in a string of digits.",
"input": "The program receives a string of nonzero length containing only digits.",
"output": "Print the maximum digit that appears in the input string."
}
},
{
"language": "ru",
"info": {
"name": "Наибольшая цифра",
"description": "Найти наибольшую цифру в строке, состоящей из цифр.",
"input": "Программа получает на вход строку ненулевой длины, содержащую только десятичные цифры.",
"output": "Выведите максимальную цифру, которая встречается во введенной строке."
}
}
],
"examples":
[
{
"input": "11111111",
"output": "1"
},
{
"input": "123034655943",
"output": "9"
},
{
"input": "4",
"output": "4"
}
]
}
Public fields of the task.
Endpoint | Method | Description |
---|---|---|
/api/task/all |
GET |
Get all tasks. |
Empty body.
Array of tasks. Each task has the public fields of the task model.
Endpoint | Method | Description |
---|---|---|
/api/task/:key |
GET |
Get a task by the task key. |
Empty body.
Public fields of the task.
Endpoint | Method | Description |
---|---|---|
/api/task/:key |
DELETE |
Delete a task by the task key. |
Empty body.
Public fields of the task.