MediaWiki icon

MediaWiki

Get, edit, or delete MediaWiki pages

Overview

This node allows you to interact with MediaWiki pages by performing operations such as retrieving page content, editing (creating or updating) pages, and deleting pages. It is useful for automating content management on any MediaWiki-based site, such as Wikipedia or private wiki installations.

Common scenarios include:

  • Automatically updating documentation pages from external sources.
  • Creating new wiki pages based on Markdown content.
  • Deleting outdated or irrelevant pages programmatically.
  • Fetching page content for analysis or backup purposes.

For example, you can use this node to convert Markdown notes into properly formatted MediaWiki pages, or to remove spam pages by specifying a deletion reason.

Properties

Name Meaning
Operation The action to perform on the MediaWiki page. Options: Get Page (retrieve content and metadata), Edit Page (create or update page content), Delete Page (remove page and revision history).
Page Title The exact title of the MediaWiki page to operate on. Must use correct capitalization and spacing. Examples: "Main Page", "User:JohnDoe", "Category:Science".
Input Format Format of the input content when editing a page. Options: MediaWiki Wikitext (content already in MediaWiki markup), Markdown (content in Markdown format that will be converted automatically to wikitext).
Page Content (Wikitext) The full content of the page in MediaWiki wikitext format. Supports standard MediaWiki markup like headings (==Heading==), links ([[Page]]), templates ({{Template}}), lists, etc. Shown only if Input Format is wikitext.
Page Content (Markdown) The full content of the page in Markdown format. Supports standard Markdown syntax like headings (# Heading), links ([text](url)), bold, italic, lists, tables, code blocks, etc. Will be converted to wikitext automatically. Shown only if Input Format is markdown.
Delete Reason A brief explanation for deleting the page, which will appear in the deletion log. Examples: "Spam", "Copyright violation", "Outdated information". Only shown for delete operation.

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 page title operated on.
  • response: The raw response from the MediaWiki API client for the operation.
  • For edit operations:
    • originalContent: The original input content provided.
    • inputFormat: The format of the input content (wikitext or markdown).
    • convertedContent: If input was Markdown, the converted MediaWiki wikitext content.
    • content: If input was wikitext, the same content repeated here.
  • For delete operations:
    • reason: The deletion reason provided, if any.
  • In case of failure (if continuing on fail), an object with success: false and an error message describing the failure.

The node does not output binary data.

Dependencies

  • Requires access to a MediaWiki API endpoint with appropriate permissions to get, edit, or delete pages.
  • Needs an API authentication credential configured in n8n to authorize requests to the MediaWiki instance.
  • Uses an internal MediaWiki client library to handle API communication.
  • Converts Markdown to MediaWiki wikitext using an internal converter if needed.

Troubleshooting

  • Missing Page Content on Edit: The node throws an error if you attempt to edit a page without providing any content. Always supply the page content when editing.
  • Invalid Operation: If an unsupported operation is specified, the node will throw an error indicating the invalid operation.
  • API Authentication Errors: Ensure the API key or token credential is correctly set up and has sufficient permissions on the MediaWiki server.
  • Conversion Issues: When using Markdown input, malformed Markdown might lead to unexpected wikitext output. Validate your Markdown syntax before running.
  • Page Not Found on Get/Delete: If the specified page title does not exist, the MediaWiki API may return an error. Verify the exact page title including capitalization and namespace prefixes.
  • Deletion Without Reason: While optional, providing a deletion reason is recommended for audit logs and transparency.

Links and References

Discussion