This documents the APIs that can be used to implement native wrappers. There are three types of APIs:
student_view_data: Exposes block settings and content as JSON data. Can be retrieved via the edX Course Blocks API. Does not include user-specific data, which is available fromstudent_view_user_state.student_view_user_state: XBlock handler which returns the currently logged in user's state data in JSON format.- Custom XBlock handlers used for submitting user input and recording user actions.
block_id: (string) The XBlock's usage ID.display_name: (string) The XBlock's display name.mode: (string) A choice of between [standard, assessment].type: (string) Always equal todrag-and-drop-v2.weight: (float) The weight of the problem.zones: (list) A list ofzoneobjects.max_attempts: (int) Maximum number of attempts in assessment mode.graded: (boolean)trueif grading is enabled.weighted_max_score: (float) The maximum score multiplied by the weight.max_items_per_zone: (int) Maximum number of items in a zone.url_name: (string) Url path for the lesson.display_zone_labels: (boolean)display_zone_borders: (boolean)items: (array) A list of draggableitem.title: (string) Title to be shown.show_title: (boolean)trueindicates the title should be shown.problem_text: (string) Problem description.show_problem_header: (boolean)trueindicates the description should be shown.target_img_expanded_url: (string) URL for the background image.target_img_description: (string) Description of the background image.item_background_color: (string) Background color for the draggable items.item_text_color: (string) Text color for the draggable items.
Contains the current state of the user interaction with the block.
attempts: (integer) Number of attempts used so far.finished: (boolean)trueif the user successfully completed the problem at least once.grade: (float) Current grade.items: (object) Object indexing each draggableitemoverall_feedback: (array) List of feedbackmessage
The zones are the target for dropping the draggable elements and contains information specific for each one:
uid: (string) Unique id.title: (string) Description.align: (string) Alignment of items.height: (int) Vertical size.width: (int) Horizontal size.x: (int) Horizontal position.y: (int) Vertical position.description: (string) Long description.
Information about each draggable item and their placement.
imageURL: (string) Relative URL for image.displayName: (string) Text description.expandedImageURL: (string) Full URL to image.id: (int) Unique id for item.correct: (boolean)trueif the item was dragged to the correct place.zone: (string) Reference to the uid of the target zone.
Contains feedback shown to the user
message: (string) Content of the feedback.
This JSON handler is used to handle dropping an item in a zone. The arguments are
val: (string) The number of the item.zone: (string) The uid of the zone.
In assessment mode will return an empty object, while in standard mode it returns the following:
correct: (boolean)trueif correct.grade: (float) Current grade for the problem.finished: (boolean)trueif finished.overall_feedback: (message) Feedback when finished.feedback: (message) Feedback for the current try.
Check submitted solution and return feedback if in assessment mode.
correct: (boolean)trueif solution is correct.attempts: (int) Number of attempts remaining.grade: (float) Final grade.misplaced_items: (array) List of misplaced items ids.feedback: (message) Feedback message for current try.overall_feedback: (message) Feedback when finished.
This endpoint is used to publish XBlock event from frontend
event_type: (string) Event identifier.
This resets the current try in assessment mode and returns the previous state.
Returns correct answer in assessment mode.
AJAX-accessible handler for expanding URLs to static image files that can be used as background.