MediaWiki icon

MediaWiki

Get, edit, or delete MediaWiki pages

Overview

This node allows you to interact with MediaWiki pages by performing three main operations: retrieving page content and metadata, editing or creating pages, and deleting pages permanently. It is useful for automating wiki content management tasks such as updating documentation, managing user pages, or cleaning up obsolete or unwanted pages.

Practical examples include:

  • Automatically fetching the current content of a wiki page to analyze or process it.
  • Updating a wiki page with new information, either by providing content in MediaWiki wikitext or Markdown format (which will be converted).
  • Deleting spam or outdated pages with an optional reason logged for audit purposes.

Properties

Name Meaning
Operation The action to perform on the MediaWiki page. Options: "Get Page", "Edit Page", "Delete Page".
Page Title The exact title of the MediaWiki page to operate on. Must use correct capitalization and spacing.
Delete Reason (Only for Delete operation) A brief reason for deleting the page that will appear in the deletion log. Examples: "Spam", "Copyright violation", "Outdated information".

Output

The node outputs an array of JSON objects, each representing the result of the operation performed on a page. The structure includes:

  • success: Boolean indicating if the operation succeeded.
  • operation: The operation performed ("get", "edit", or "delete").
  • title: The title of the page operated on.
  • response: The raw response from the MediaWiki API client for the operation.

Additional fields depending on the operation:

  • For edit:

    • originalContent: The original input content provided.
    • inputFormat: The format of the input content ("wikitext" or "markdown").
    • convertedContent: If input was Markdown, this contains the converted MediaWiki wikitext content.
    • content: If input was wikitext, this repeats the original content.
  • For delete:

    • reason: The deletion reason provided, if any.

If an error occurs and the node is set to continue on failure, the output JSON will contain:

  • success: false
  • error: The error message describing what went wrong.

The node does not output binary data.

Dependencies

  • Requires access to a MediaWiki API endpoint via credentials containing an API key or authentication token.
  • Uses an internal MediaWiki client library to communicate with the MediaWiki API.
  • Converts Markdown to MediaWiki wikitext using an internal converter when editing pages with Markdown input.

Troubleshooting

  • Missing Page Content on Edit: If you attempt to edit a page without providing content, the node throws an error stating that page content is required.
  • Invalid Operation: Providing an unsupported operation value results in an error indicating the operation is invalid.
  • API Authentication Issues: Failure to authenticate with the MediaWiki API will cause errors; ensure valid credentials are configured.
  • Page Not Found on Get/Delete: Trying to get or delete a non-existent page may result in API errors; verify the page title is correct.
  • Markdown Conversion Errors: If Markdown content is malformed, conversion to wikitext might fail or produce unexpected results.

To resolve errors:

  • Double-check all required parameters, especially page titles and content.
  • Ensure proper API credentials are set up in n8n.
  • Use correct input formats and validate Markdown syntax if applicable.
  • Enable "Continue On Fail" to handle errors gracefully in workflows.

Links and References

Discussion