Save task and compute feedback for saved task
Compute feedback for our task in two steps:
- Send task to the Taskbase platform.
- Request feedback for a learner's answer to the task.
Setup
You will need
- a valid API token
- a specific task
- some learners' answers
Tutorial
Step 1: Send task
Send task and obtain its relevant evaluation criteria. The taskDefinition.id
is the identifier used in subsequent requests to target this task. The identifier is provided by your system and needs to be unique.
The response will include a list of aspects, which are the evaluation criteria used to assess a learner's answer.
For API reference see Returns all relevant Aspects for a given task.
API Call Example:
- Default server https://api.taskbase.com/tasks/aspects/compute
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
https://api.taskbase.com/tasks/aspects/compute \
-H 'Authorization: Bearer <YOUR_UUID_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"tenantId": "product_123",
"taskDefinition": {
"id": "your_id_as_string",
"problemStatement": "When was the Battle of Waterloo?",
"type": "FREEFORM_TEXT"
}
}'
[ { "name": "Present 3rd person singular of regular verbs.", "description": "A learner can correctly form the present 3rd person singular of regular verbs.", "type": "CONCEPT", "aspectGroup": { … } } ]
API Call Response Example Excerpt:
[
...
{
"name": "Present 3rd person singular of regular verbs",
"description": "The student can correctly form the present 3rd person singular of regular verbs.",
"type": "CONCEPT",
"aspectGroup": {
"name": "Grammar",
"description": "Grammatical concepts such as conjugation, tenses and conditionals"
}
},
...
]
Step 2: Request feedback
You now have a task in the Taskbase platform. You can request feedback by providing the learner's answer To target that task, use the same taskDefinition.id
as part of the URL.
For API reference see Compute feedback for an existing task.
API Call Example:
- Default server https://api.taskbase.com/tasks/${taskId}/feedback/compute
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X POST \
'https://api.taskbase.com/tasks/${taskId}/feedback/compute' \
-H 'Authorization: Bearer <YOUR_UUID_HERE>' \
-H 'Content-Type: application/json' \
-d '{
"userId": "some_anonymous_id",
"taskType": "FREEFORM_TEXT",
"answer": {
"content": "The Battle of Waterloo was in 1815."
}
}'
{ "userId": "some_anonymous_id", "taskId": "0Ihkl0CyzoWSjDm5F", "taskType": "FREEFORM_TEXT", "metaData": { "taskAction": "CREATED", "tenantId": "string", "taskLink": "string" }, "result": { "sampleSolution": { … }, "feedback": [ … ], "answer": { … }, "allAspects": [ … ] } }
API Call Response Example Excerpt:
{
...
"result": {
"sampleSolution": {
"content": "The Battle of Waterloo was in 1815."
},
"feedback": [
{
"correctness": "correct",
"aspects": [
{
"name": "Present 3rd person singular of regular verbs",
"description": "A student can correctly form the present 3rd person singular of regular verbs.",
"type": "CONCEPT",
"aspectGroup": {
"name": "Grammar",
"description": "Grammatical concepts such as conjugation, tenses and conditionals"
}
}
],
"message": "Indeed, the Battle of Waterloo was on Saturday, the 15th of June 1815",
"context": [
{
"content": "was in 1815",
"offset": 23,
"length": 11
}
]
}
],
"answer": {
"content": "The Battle of Waterloo was in 1815."
},
...
}
}
Outcome
You sent a task and then requested feedback on a learner's answer to it.