Skip to content

Drag and Drop

The user drags items into target zones. Requires the content field.

Content Schema

{
"items": [
{ "id": "1", "text": "Apple", "correctZoneId": "fruit" },
{ "id": "2", "text": "Carrot", "correctZoneId": "vegetable" }
],
"zones": [
{ "id": "fruit", "label": "Fruits" },
{ "id": "vegetable", "label": "Vegetables" }
]
}

Answer Format

answer = JSON.stringify({ item_id: zone_id })

Items missing from answer count as incorrect.

Request

{
"exerciseId": "ex_004",
"area": "vocabulary",
"type": "drag_and_drop",
"answer": "{\"1\":\"fruit\",\"2\":\"vegetable\"}",
"content": {
"items": [
{ "id": "1", "text": "Apple", "correctZoneId": "fruit" },
{ "id": "2", "text": "Carrot", "correctZoneId": "vegetable" }
],
"zones": [
{ "id": "fruit", "label": "Fruits" },
{ "id": "vegetable", "label": "Vegetables" }
]
}
}

Responses

// All correct
{ "correct": true, "score": 10, "feedback": "All items placed correctly!", "metadata": { "area": "vocabulary", "type": "drag_and_drop" } }
// Partial (1 of 2)
{ "correct": false, "score": 5, "feedback": "You placed 1 out of 2 items correctly.", "metadata": { "area": "vocabulary", "type": "drag_and_drop" } }

Score = Math.round((correct_items / total) * 10)