Moodle

Interact with Moodle LMS - Complete Integration (v0.1.0)

Overview

This node integrates with the Moodle Learning Management System (LMS) to manage courses, users, enrollments, grades, messages, and system information via Moodle's web service API. Specifically, the Course - Delete operation allows you to delete a course by its ID from your Moodle instance.

Typical use cases include:

  • Automating course lifecycle management by removing outdated or obsolete courses.
  • Cleaning up test or temporary courses in bulk.
  • Integrating Moodle course deletion into broader workflows such as user offboarding or curriculum updates.

Example: You have a workflow that triggers when a course is no longer needed, and this node deletes the course from Moodle automatically by specifying its Course ID.

Properties

Name Meaning
Course ID The unique numeric identifier of the course to delete. This is required to specify which course should be removed.

Output

The node outputs a JSON object indicating the success of the deletion operation. The structure is:

{
  "success": true,
  "message": "Course <courseId> deleted successfully"
}

Where <courseId> is the ID of the deleted course.

No binary data output is produced by this operation.

Dependencies

  • Requires an active connection to a Moodle instance with web services enabled.
  • Needs an API key credential configured in n8n for authenticating requests to Moodle's REST API.
  • The Moodle web service function core_course_delete_courses must be enabled and accessible by the API user.
  • The node uses HTTP POST requests to communicate with Moodle's API endpoints.

Troubleshooting

Common Issues

  • Permission Denied: The API user may lack permissions to delete courses. Ensure the API token has sufficient rights.
  • Invalid Course ID: Providing a non-existent or incorrect course ID will result in failure or no action.
  • Web Service Disabled: Moodle web services or the specific function might not be enabled on the server.
  • Network Connectivity: Connection issues between n8n and Moodle can cause request failures.

Error Messages and Resolutions

  • "Course not found" or empty response: Verify the Course ID is correct and the course exists.
  • Authentication errors: Check that the API key credential is valid and has not expired.
  • "Function core_course_delete_courses not available": Confirm that the Moodle version supports this function and it is enabled in the external services configuration.
  • Unhandled exceptions: Enable "Continue On Fail" in the node settings to handle errors gracefully during batch operations.

Links and References


This summary focuses solely on the static analysis of the node’s execute() method for the Course - Delete operation and does not infer runtime behavior beyond the code provided.

Discussion