Code snippets in Python demonstrating how to use various modules of the MediaWiki Action API
- API:Tokens
- tokens.py: get tokens for data modifying operations
- API:Login
- login.py: login
- API:Logout
- logout.py: logout
- API:Account creation
- create_account.py: create an account on a wiki without any special authentication extensions
- API:Block
- block_user.py: block a user
- API:Blocks
- get_blocked_users.py: get information about recent blocked users
- API:Users
- get_users.py: get information about a list of users
- API:User contributions
- get_usercontribs.py: list user contributions
- API:User group membership
- userrights.py: add and remove user rights
- API:Watchlist feed
- get_my_watchlist_feed.py: access an RSS feed of your own watchlist
- get_user_watchlist_feed.py: access an RSS feed of another user's watchlist
- API:Options
- change_user_options.py: change preferences of current user
- API:Emailuser
- send_an_email.py: send an email to user
- API:Watchlist
- get_watchlist.py: get the currently logged-in user's watchlist
- API:Watchlistraw
- get_watchlistraw.py: get three pages on the logged-in user's watchlist from the main namespace
- API:Rsd
- rsd.py: export an RSD schema
- API:Validatepassword
- validatepassword.py: validate a password against the wiki's password policies
- API:Resetpassword
- reset_password.py: Reset password for all users with an email address.
- API:Feedcontributions
- get_user_contributions_feed.py: Show contributions of a user as an RSS feed.
- API:Userinfo
- userinfo.py: get general user info and user rights
- API:Parse
- parse.py: parse content of a page
- parse_wikitable.py: parse a section of its page and fetch its table data
- API:Pageswithprop
- get_pageswithprop.py: list all pages using a given page property
- API:Categorymembers
- get_category_items.py: list twenty items in a category
- get_recent_category_items.py: get the ten articles most recently added to a category
- get_subcategories.py: get ten subcategories of a category
- API:Categoryinfo
- get_category_info.py: get info about few categories
- API:Images
- get_page_images.py: get page images embedded on a page
- API:Purge
- purge_two_pages.py: purge cache of two or more pages
- purge_namespace_pages.py: purge cache of the first 10 pages in the main namespace
- API:Redirects
- redirects.py: return redirects to the given page(s)
- API:Delete
- delete.py: delete a page
- API:Deletedrevs
- get_deleted_revisions.py: list deleted revisions from a user
- API:Deletedrevisions
- get_deleted_revs.py: list deleted revisions for a page
- API:Revisions
- get_pages_revisions.py: get revision data of multiple pages
- get_filtered_page_revisions.py: get revision data of a page filtered by date and user
- API:Allrevisions
- get_allrevisions.py: get revision data of multiple pages and users
- API:Alldeletedrevisions
- get_alldeletedrevs.py: get all deleted revision data by a user or in a namespace.
- API:Links
- get_links.py: get links embedded on a page
- get_red_links.py: get the first twenty red links in a page
- API:Info
- get_info.py: get basic information about a page
- API:Allpages
- get_allpages.py: get all pages which fit a certain criteria, within a namespace
- API:Edit
- edit.py: edit a page
- API:Allimages
- get_allimages_by_date.py: list all images in a namespace, starting from a certain timestamp
- get_allimages_by_name.py: list all images in a namespace, starting from a certain filename
- API:Imageinfo
- get_imageinfo.py get information about an image file
- API:Categories
- get_categories.py: get categories associated with a page
- API:Allcategories
- get_allcategories.py: get all categories that fit certain criteria relating to their titles
- API:Allusers
- get_allusers.py: get a list of all registered users, as ordered by username
- get_allcategories.py: get all categories that fit certain criteria relating to their titles
- API:Backlinks
- get_backlinks.py: list pages which link to a certain page
- API:Random
- get_random.py: get a list of random pages
- API:Move
- move.py: move a page
- API:Watch
- watch.py: add a page to your watchlist
- API:Alllinks
- get_alllinks.py: list links to a namespace
- API:Exturlusage
- get_exturlusage.py: enumerate pages that contain a given URL
- API:RecentChanges
- get_recent_changes.py: get the three most recent changes with sizes and flags
- API:Querypage
- get_querypage_list.py: List first 10 pages which are uncategorized
- API:SetPageLanguage
- set_page_language.py: change page language
- API:Embeddedin
- get_embedded_pages.py: get all page(s) that embed a page
- API:Rollback
- rollback.py: rollback the last edits made to a given page
- API:Allfileusages
- get_allfileusages.py: list of all file usages
- API:Protect
- protect.py: Change the protection level of a given page
- API:Upload
- upload_file_directly.py: upload a file directly from the system
- upload_file_from_url.py: upload a file from a URL
- upload_file_in_chunks.py: upload a file in chunks
- API:Pagepropnames
- get_pagepropnames.py: List all page property names in use on the wiki
- API:Protectedtitles
- get_protectedtitles.py: List the first 2 titles which only sysops can create
- API:Imageusage
- get_imageusage.py: List the first three pages that use a given image title.
- API:Import
- import_interwiki.py: Import a page from another wiki by specifying its title
- import_xml.py: Import a page from another wiki by uploading its xml dump
- API:Patrol
- patrol.py: Patrol a recent change
- API:Iwlinks
- get_iwlinks.py: get the interwiki links from a given page
- API:Undelete
- undelete.py: restore two revisions of a deleted page
- API:Logevents
- get_logevents.py: get the three most recent log events
- API:Tags
- get_tags.py: get the first three change tags and their hitcounts
- API:Allredirects
- get_allredirects.py: get the first three unique pages containing redirects to the main namespace
- API:Alltransclusions
- get_alltransclusions.py: get three unique pages in the main namespace which contain transclusions
- API:Mergehistory
- mergehistory.py: Merge the page revisions of Oldpage dating up to 2015-12-31T04:37:41Z into Newpage
- API:Contributors
- get_contributors.js: get request to list all logged-in contributors and count of anonymous contributors to a page
- API:Stashedit
- stashedit.py: Prepare an edit in shared cache
- API:Filearchive
- filearchive.py: Enumerate all deleted files from filearchive table sequentially
- API:Siteinfo
- general_site_info.py: obtain general site info
- API:Expandtemplates
- expand_templates.py: expand the Project:Sandbox template
- API:ClearHasMsg
- clear_has_msg.py: clear the hasmsg flag for the current user
- API:Compare
- compare.py: Compare the current revisions of two different pages
- API:Tag
- tag.py: Remove the spam tag from log entry ID 123 with the reason Wrongly applied
- API:Duplicatefiles
- duplicate_files.py: list duplicates of the given files
- API:Filerepoinfo
- file_repo_info.py: get information about file repositories
- API:Iwbacklinks
- iwbacklinks.py: Get pages that link to a given interwiki link.
- API:Checktoken
- check_token.py: Check a CSRF token
- API:Deletedrevisions
- deleted_revisions.py: Get a list of deleted revisions for Talk:Main Page.
- API:Revisiondelete
- revision_delete.py: Hide all information about a certain revision ID.
- API:Filearchive
- file_archive.py: Get a list of all deleted files.
- API:Fileusage
- get_file_usage.py: Get a list of pages using a given file.
- API:Feedrecentchanges
- get_feed_recent_changes.py: Show recent changes as an RSS feed.
- API:Setnotificationtimestamp
- set_notification_timestamp.py: Reset the notification status for the entire watchlist.
- API:Langbacklinks
- langbacklinks.py: get pages linking to a given language link
- API:Templates
- templates.py: get a list of templates used on a page
- API:Pageprops
- pageprops.py: get various properties defined in the page content
- API:Extlinks
- get_extlinks.py: get a list of external links on a page
- API:Linkshere
- linkshere.py: get a list of pages linking to a given page,
- API:Allmessages
- all_messages.py: get the Dutch translations of some messages
- API:Transcludedin
- get_transcluded_in.py: get a list of pages which transclude a given page
- API:Langlinks
- langlinks.py: get a list of language links that a given page has
- API:Stashimageinfo
- stash_image_info.py: return information for a stashed file
- API:Search
- search.py: search for a title or a text
- API:Geosearch
- geosearch.py: search for pages nearby
- geoimagesearch.py: search for pages nearby with images
- geocoordinates.py: obtain coordinates for wiki pages nearby
- API:Opensearch
- opensearch.py: fetch results in an opensearch format
- API:Prefixsearch
- prefixsearch.py: perform a prefix search for page titles
- API:Languagesearch
- languagesearch.py: search for a language
- API:Parameter information
- paraminfo.py: get information about another action API module and its parameters
- API:Main_module
- main_module.py: Get help for the main module.
- API:Help
- get_help.py: Get help for a specified module.