Send task and answer to get feedback

Objective

Request feedback for your task in one step.

Setup

You will need

  • a valid API token
  • a task specificaiton
  • some learners' answers

Tutorial

Request feedback by sending the task and learner's answer at the same time.

In this example, we request feedback in a single API call by sending both the task and answer together. You can make additional requests for the same task, identified by taskDefinition.id.

The feedback will account for changes to the content. However, note that breaking changes, such as removing gaps or making significant edits to the assignment or content, may lead to unexpected results—especially for use cases like analytics. In such situations, consider updating the taskDefinition.id to target a new task.

For an API reference see Compute feedback for the provided task and answer.

API Call Example:

curl -i -X POST \
  https://api.taskbase.com/feedback/compute \
  -H 'Authorization: Bearer <YOUR_UUID_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "userId": "some_anonymous_id",
    "taskType": "FREEFORM_TEXT",
    "taskDefinition": {
      "id": "your_id_as_string",
      "problemStatement": "When was the Battle of Waterloo?",
      "type": "FREEFORM_TEXT"
    },
    "answer": {
      "content": "The Battle of Waterloo was in 1815."
    }
  }'
Response
application/json
{ "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:

{
  "userId": "some_anonymous_id",
  "taskId": "0Ihkl0CyzoWSjDm5F",
  "taskType": "FREEFORM_TEXT",
  "metaData": {
    "taskAction": "CREATED",
    "tenantId": "string",
    "taskLink": "string"
  },
  "result": {
    "sampleSolution": {
      "content": "The Battle of Waterloo was in 1815."
    },
    "feedback": [
      {
        "correctness": "correct",
        "topic": {
          "name": "string"
        },
        "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."
    },
    "allAspects": [
      {
        "aspect": {
          "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"
          }
        },
        "context": [
          {
            "content": "was in 1815",
            "offset": 23,
            "length": 11
          }
        ]
      }
    ]
  }
}

Outcome

You requested feedback on a learner's answer in a single API call.