<?xml version="1.0" encoding="utf-8"?> <api> <error code="help" info=""> This API allows programs to access various functions of MediaWiki software. For more details see API Home Page @ http://meta.wikimedia.org/wiki/API Status: ALPHA -- all features shown on this page should be working, but the API is still in active development, and may change at any time. Make sure you monitor changes to this page, wikitech-l mailing list, or the source code in the includes/api directory for any changes. Parameters: format - The format of the output One value: json, jsonfm, php, phpfm, wddx, wddxfm, xml, xmlfm, yaml, yamlfm, rawfm Default: xmlfm action - What action you would like to perform One value: help, login, opensearch, feedwatchlist, query Default: help version - When showing help, include version for each module *** *** *** *** *** *** *** *** *** *** Modules *** *** *** *** *** *** *** *** *** *** * action=help * Display this help screen. * action=login * This module is used to login and get the authentication tokens. Parameters: lgname - User Name lgpassword - Password lgdomain - Domain (optional) Example: api.php?action=login&lgname=user&lgpassword=password * action=opensearch * This module implements OpenSearch protocol Parameters: search - Search string Example: api.php?action=opensearch&search=Te * action=feedwatchlist * This module returns a watchlist feed Parameters: feedformat - The format of the feed One value: rss, atom Default: rss Example: api.php?action=feedwatchlist * action=query * Query API module allows applications to get needed pieces of data from the MediaWiki databases, and is loosely based on the Query API interface currently available on all MediaWiki servers. All data modifications will first have to use query to acquire a token to prevent abuse from malicious sites. Parameters: titles - A list of titles to work on pageids - A list of page IDs to work on revids - A list of revision IDs to work on prop - Which properties to get for the titles/revisions/pageids Values (separate with '|'): info, revisions list - Which lists to get Values (separate with '|'): allpages, logevents, watchlist, recentchanges, backlinks, embeddedin, imagelinks, usercontribs meta - Which meta data to get about the site Values (separate with '|'): siteinfo generator - Use the output of a list as the input for other prop/list/meta items One value: allpages, logevents, watchlist, recentchanges, backlinks, embeddedin, imagelinks, usercontribs, info, revisions redirects - Automatically resolve redirects Example: api.php?action=query&prop=revisions&meta=siteinfo&titles=Main%20Page&rvprop=user|comment --- --- --- --- --- --- --- --- Query: Prop --- --- --- --- --- --- --- --- * prop=info * Get basic page information such as namespace, title, last touched date, ... Example: api.php?action=query&prop=info&titles=Main%20Page * prop=revisions * Get revision information. This module may be used in several ways: 1) Get data about a set of pages (last revision), by setting titles or pageids parameter. 2) Get revisions for one given page, by using titles/pageids with start/end/limit params. 3) Get data about a set of revisions by setting their IDs with revids parameter. All parameters marked as (enum) may only be used with a single page (#2). Parameters: rvprop - Which properties to get for each revision. Values (separate with '|'): timestamp, user, comment, content rvlimit - limit how many revisions will be returned (enum) rvstartid - from which revision id to start enumeration (enum) rvendid - stop revision enumeration on this revid (enum) rvstart - from which revision timestamp to start enumeration (enum) rvend - enumerate up to this timestamp (enum) rvdir - direction of enumeration - towards "newer" or "older" revisions (enum) One value: newer, older Default: older Examples: Get data with content for the last revision of titles "API" and "Main Page": api.php?action=query&prop=revisions&titles=API|Main%20Page&rvprop=timestamp|user|comment|content Get last 5 revisions of the "Main Page": api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment Get first 5 revisions of the "Main Page": api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer Get first 5 revisions of the "Main Page" made after 2006-05-01: api.php?action=query&prop=revisions&titles=Main%20Page&rvlimit=5&rvprop=timestamp|user|comment&rvdir=newer&rvstart=20060501000000 --- --- --- --- --- --- --- --- Query: List --- --- --- --- --- --- --- --- * list=allpages * Enumerate all pages sequentially in a given namespace Parameters: apfrom - The page title to start enumerating from. apprefix - Search for all page titles that begin with this value. apnamespace - The namespace to enumerate. One value: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 Default: 0 apfilterredir - Which pages to list. One value: all, redirects, nonredirects Default: all aplimit - How many total pages to return. Default: 10 Examples: Simple Use Show a list of pages starting at the letter "B" api.php?action=query&list=allpages&apfrom=B Using as Generator Show info about 4 pages starting at the letter "T" api.php?action=query&generator=allpages&gaplimit=4&gapfrom=T&prop=info Show content of first 2 non-redirect pages begining at "Re" api.php?action=query&generator=allpages&gaplimit=2&gapfilterredir=nonredirects&gapfrom=Re&prop=revisions&rvprop=content Generator: This module may be used as a generator * list=logevents * Get events from logs. Parameters: letype - Filter log entries to only this type(s) Values (separate with '|'): block, protect, rights, delete, upload, move, import, renameuser, newusers, makebot lestart - The timestamp to start enumerating from. leend - The timestamp to end enumerating. ledir - In which direction to enumerate. One value: newer, older Default: older leuser - Filter entries to those made by the given user. letitle - Filter entries to those related to a page. lelimit - How many total event entries to return. Default: 10 Example: api.php?action=query&list=logevents * list=watchlist * Parameters: wlallrev - Include multiple revisions of the same page within given timeframe. wlstart - The timestamp to start enumerating from. wlend - The timestamp to end enumerating. wlnamespace - Filter changes to only the given namespace(s). Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 wldir - In which direction to enumerate pages. One value: newer, older Default: older wllimit - How many total pages to return per request. Default: 10 wlprop - Which additional items to get (non-generator mode only). Values (separate with '|'): user, comment, timestamp, patrol Examples: api.php?action=query&list=watchlist api.php?action=query&list=watchlist&wlallrev api.php?action=query&generator=watchlist&prop=info api.php?action=query&generator=watchlist&gwlallrev&prop=revisions&rvprop=timestamp|user Generator: This module may be used as a generator * list=recentchanges * Enumerate recent changes Parameters: rcstart - The timestamp to start enumerating from. rcend - The timestamp to end enumerating. rcdir - In which direction to enumerate. One value: newer, older Default: older rcnamespace - Filter log entries to only this namespace(s) Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 rcprop - Include additional pieces of information Values (separate with '|'): user, comment, flags rcshow - Show only items that meet this criteria. For example, to see only minor edits done by logged-in users, set show=minor|!anon Values (separate with '|'): minor, !minor, bot, !bot, anon, !anon rclimit - How many total pages to return. Default: 10 Example: api.php?action=query&list=recentchanges * list=backlinks * Find all pages that link to the given page Parameters: blcontinue - When more results are available, use this to continue. blnamespace - The namespace to enumerate. Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 blredirect - If linking page is a redirect, find all pages that link to that redirect (not implemented) bllimit - How many total pages to return. Default: 10 Examples: api.php?action=query&list=backlinks&titles=Main%20Page api.php?action=query&generator=backlinks&titles=Main%20Page&prop=info Generator: This module may be used as a generator * list=embeddedin * Find all pages that embed (transclude) the given title Parameters: eicontinue - When more results are available, use this to continue. einamespace - The namespace to enumerate. Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 eiredirect - If linking page is a redirect, find all pages that link to that redirect (not implemented) eilimit - How many total pages to return. Default: 10 Examples: api.php?action=query&list=embeddedin&titles=Template:Stub api.php?action=query&generator=embeddedin&titles=Template:Stub&prop=info Generator: This module may be used as a generator * list=imagelinks * Find all pages that use the given image title. Parameters: ilcontinue - When more results are available, use this to continue. ilnamespace - The namespace to enumerate. Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1000, 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008, 1009 ilredirect - If linking page is a redirect, find all pages that link to that redirect (not implemented) illimit - How many total pages to return. Default: 10 Examples: api.php?action=query&list=imagelinks&titles=Image:Albert%20Einstein%20Head.jpg api.php?action=query&generator=imagelinks&titles=Image:Albert%20Einstein%20Head.jpg&prop=info Generator: This module may be used as a generator * list=usercontribs * Get edits by a user.. Parameters: uclimit - The maximum number of contributions to return. Default: 10 ucstart - The start timestamp to return from. ucend - The end timestamp to return to. ucuser - The user to retrieve contributions for. ucdir - The direction to search (older or newer). One value: newer, older Default: older Example: api.php?action=query&list=usercontribs&ucuser=YurikBot --- --- --- --- --- --- --- --- Query: Meta --- --- --- --- --- --- --- --- * meta=siteinfo * Return general information about the site. Parameters: siprop - Which sysinfo properties to get: "general" - Overall system information "namespaces" - List of registered namespaces (localized) Values (separate with '|'): general, namespaces Default: general Example: api.php?action=query&meta=siteinfo&siprop=general|namespaces *** *** *** *** *** *** *** *** *** *** Formats *** *** *** *** *** *** *** *** *** *** * format=json * Output data in JSON format Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=json * format=jsonfm * Output data in JSON format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=jsonfm * format=php * Output data in serialized PHP format Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=php * format=phpfm * Output data in serialized PHP format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=phpfm * format=wddx * Output data in WDDX format Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=wddx * format=wddxfm * Output data in WDDX format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=wddxfm * format=xml * Output data in XML format Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=xml * format=xmlfm * Output data in XML format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=xmlfm * format=yaml * Output data in YAML format Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=yaml * format=yamlfm * Output data in YAML format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=yamlfm * format=rawfm * Output data with the debuging elements in JSON format (pretty-print in HTML) Example: api.php?action=query&meta=siteinfo&siprop=namespaces&format=rawfm *** Credits: *** This API is being implemented by Yuri Astrakhan [[User:Yurik]] / FirstnameLastname@gmail.com Please leave your comments and suggestions at http://meta.wikimedia.org/wiki/API </error> </api>