Question Web Service Import

Local plugins ::: local_questions_importer_ws
Maintained by Andrea Bertelli
Import Moodle XML questions directly into a course via Web Services. Description: This local plugin provides a dedicated external Web Service function (local_questions_importer_ws_import_xml) designed to facilitate the bulk import of questions from external systems. It accepts standard Moodle XML files uploaded to the user's draft area and processes them into the specified target course. The importer automatically handles category creation and hierarchy within the course context, making it ideal for integrations with third-party question banks or authoring tools. Key Features: Simple API: A single function call to import from a draft file. Standard Format: Fully supports the robust Moodle XML question format. Automatic Categorization: Recursively creates question categories as defined in the XML. Secure: Uses standard Moodle Web Service authentication and capabilities.
Latest release:
6 downloads
Current versions available: 1

The Questions Web Service Importer is a specialized local plugin designed to bridge the gap between external systems and the Moodle Question Bank. It exposes a custom Web Service API that enables the programmatic import of Moodle XML question files directly into specific courses.

Why use this plugin? By default, Moodle allows teachers to import questions manually via the user interface. However, institutions often have legacy systems, third-party question authoring tools, or migration scripts that generate questions in bulk. This plugin allows you to automate that pipeline, pushing thousands of questions into Moodle courses without a single manual click.

How it works The process is streamlined for automation:

Upload: Your external application uploads a standard Moodle XML file to the Moodle "Draft" file area via the Core Files API.
Import: Your application calls the exposed function local_questions_importer_ws_import_xml, providing the target courseid and the draftitemid of the uploaded file.
Process: The plugin parses the XML, creates all necessary categories (respecting hierarchy), and saves the questions into the course context.

Key Features

Fully Automated: No manual intervention required for question bank population.
Recursive Category Creation: Automatically builds the category tree structure defined in your XML file (e.g., Top/Year 1/Math/Algebra).
Standard Compliance: Built on top of Moodle's native XML import format (qformat_xml) and Question Bank API, ensuring compatibility with all standard question types.
Secure & Traceable: Operations are performed under a specific capability local/questions_importer_ws:import, ensuring only authorized service users can push content.

Usage Scenario
Ideal for universities migration projects where a Python/PHP script reads from a legacy database, generates Moodle XML, and pushes it directly to new course shells on the production server.

Requirements

  • Moodle 4.5 or later.
  • Web Services enabled on your site.
  • A service user with the local/questions_importer_ws:import capability.

Screenshots

Screenshot #0
Screenshot #1
Screenshot #2

Contributors

Andrea Bertelli (Lead maintainer)
Please login to view contributors details and/or to contact them

Comments

Mostrar comentários
Please login to post comments