Couchds

Joined 16 April 2019
Revision as of 17:01, 6 October 2020 by Couchds (talk | contribs) (Created page with "<!-- API warnings and errors: { "warnings": { "main": { "warnings": "A POST request was made without a \"Content-Type\" header. This does not work reli...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

<!DOCTYPE html> <html class="client-nojs" lang="en" dir="ltr"> <head> <meta charset="UTF-8"/> <title>MediaWiki API help - Compendium of Cancer Genome Aberrations</title> <script>document.documentElement.className="client-js";RLCONF={"wgBreakFrames":!0,"wgSeparatorTransformTable":["",""],"wgDigitTransformTable":["",""],"wgDefaultDateFormat":"dmy","wgMonthNames":["","January","February","March","April","May","June","July","August","September","October","November","December"],"wgRequestId":"92b68b192c8d405056932306","wgCSPNonce":!1,"wgCanonicalNamespace":"Special","wgCanonicalSpecialPageName":"ApiHelp","wgNamespaceNumber":-1,"wgPageName":"Special:ApiHelp","wgTitle":"ApiHelp","wgCurRevisionId":0,"wgRevisionId":0,"wgArticleId":0,"wgIsArticle":!1,"wgIsRedirect":!1,"wgAction":"view","wgUserName":null,"wgUserGroups":["*"],"wgCategories":[],"wgPageContentLanguage":"en","wgPageContentModel":"wikitext","wgRelevantPageName":"Special:ApiHelp","wgRelevantArticleId":0,"wgIsProbablyEditable":!1,"wgRelevantPageIsProbablyEditable":!1,"wgVisualEditor":{"pageLanguageCode":"en","pageLanguageDir":"ltr","pageVariantFallbacks":"en"},"wgEditSubmitButtonLabelPublish": !1};RLSTATE={"site.styles":"ready","noscript":"ready","user.styles":"ready","user":"ready","user.options":"loading","mediawiki.hlist":"ready","mediawiki.apipretty":"ready","mediawiki.skinning.interface":"ready","ext.visualEditor.desktopArticleTarget.noscript":"ready"};RLPAGEMODULES=["site","mediawiki.page.startup","mediawiki.page.ready","ext.visualEditor.desktopArticleTarget.init","ext.visualEditor.targetLoader"];</script> <script>(RLQ=window.RLQ||[]).push(function(){mw.loader.implement("user.options@1hzgi",function($,jQuery,require,module){/*@nomin*/mw.user.tokens.set({"patrolToken":"+\\","watchToken":"+\\","csrfToken":"+\\"}); });});</script> <link rel="stylesheet" href="/load.php?lang=en&modules=ext.visualEditor.desktopArticleTarget.noscript%7Cmediawiki.apipretty%2Chlist%7Cmediawiki.skinning.interface&only=styles&skin=apioutput"/> <script async="" src="/load.php?lang=en&modules=startup&only=scripts&raw=1&skin=apioutput"></script> <meta name="generator" content="MediaWiki 1.35.0"/> <meta name="robots" content="noindex,nofollow"/> <link rel="shortcut icon" href="/favicon.ico"/> <link rel="search" type="application/opensearchdescription+xml" href="/opensearch_desc.php" title="Compendium of Cancer Genome Aberrations (en)"/> <link rel="EditURI" type="application/rsd+xml" href="https://ccga.io/api.php?action=rsd"/> <link rel="license" href="https://www.mediawiki.org/wiki/Special:MyLanguage/Copyright"/> <link rel="alternate" type="application/atom+xml" title="Compendium of Cancer Genome Aberrations Atom feed" href="/index.php?title=Special:RecentChanges&feed=atom"/> </head>

<body class="mediawiki ltr sitedir-ltr mw-hide-empty-elt ns--1 ns-special mw-special-ApiHelp page-Special_ApiHelp rootpage-Special_ApiHelp skin-apioutput action-view skin-vector-legacy">

MediaWiki API help

This is an auto-generated MediaWiki API documentation page.

Documentation and examples: <a class="external free" href="https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page">https://www.mediawiki.org/wiki/Special:MyLanguage/API:Main_page</a>

Main module

  • Source: MediaWiki
  • License: <a href="/index.php/Special:Version/License/MediaWiki" title="Special:Version/License/MediaWiki">GPL-2.0-or-later</a>

Status: The MediaWiki API is a mature and stable interface that is actively supported and improved. While we try to avoid it, we may occasionally need to make breaking changes; subscribe to <a rel="nofollow" class="external text" href="https://lists.wikimedia.org/pipermail/mediawiki-api-announce/">the mediawiki-api-announce mailing list</a> for notice of updates.

Erroneous requests: When erroneous requests are sent to the API, an HTTP header will be sent with the key "MediaWiki-API-Error" and then both the value of the header and the error code sent back will be set to the same value. For more information see <a href="http://www.mediawiki.org/wiki/Special:MyLanguage/API:Errors_and_warnings" class="extiw" title="mw:Special:MyLanguage/API:Errors and warnings">API: Errors and warnings</a>.

Parameters:
action

Which action to perform.

<a href="/api.php?action=help&modules=block">block</a>
Block a user.
<a href="/api.php?action=help&modules=changeauthenticationdata">changeauthenticationdata</a>
Change authentication data for the current user.
<a href="/api.php?action=help&modules=changecontentmodel">changecontentmodel</a>
Change the content model of a page
<a href="/api.php?action=help&modules=checktoken">checktoken</a>
Check the validity of a token from <a href="/api.php?action=help&modules=query%2Btokens">action=query&meta=tokens</a>.
<a href="/api.php?action=help&modules=clearhasmsg">clearhasmsg</a>
Clears the hasmsg flag for the current user.
<a href="/api.php?action=help&modules=clientlogin">clientlogin</a>
Log in to the wiki using the interactive flow.
<a href="/api.php?action=help&modules=compare">compare</a>
Get the difference between two pages.
<a href="/api.php?action=help&modules=createaccount">createaccount</a>
Create a new user account.
<a href="/api.php?action=help&modules=delete">delete</a>
Delete a page.
<a href="/api.php?action=help&modules=edit">edit</a>
Create and edit pages.
<a href="/api.php?action=help&modules=emailuser">emailuser</a>
Email a user.
<a href="/api.php?action=help&modules=expandtemplates">expandtemplates</a>
Expands all templates within wikitext.
<a href="/api.php?action=help&modules=feedcontributions">feedcontributions</a>
Returns a user's contributions feed.
<a href="/api.php?action=help&modules=feedrecentchanges">feedrecentchanges</a>
Returns a recent changes feed.
<a href="/api.php?action=help&modules=feedwatchlist">feedwatchlist</a>
Returns a watchlist feed.
<a href="/api.php?action=help&modules=filerevert">filerevert</a>
Revert a file to an old version.
<a href="/api.php?action=help&modules=help">help</a>
Display help for the specified modules.
<a href="/api.php?action=help&modules=imagerotate">imagerotate</a>
Rotate one or more images.
<a href="/api.php?action=help&modules=import">import</a>
Import a page from another wiki, or from an XML file.
<a href="/api.php?action=help&modules=linkaccount">linkaccount</a>
Link an account from a third-party provider to the current user.
<a href="/api.php?action=help&modules=login">login</a>
Log in and get authentication cookies.
<a href="/api.php?action=help&modules=logout">logout</a>
Log out and clear session data.
<a href="/api.php?action=help&modules=managetags">managetags</a>
Perform management tasks relating to change tags.
<a href="/api.php?action=help&modules=mergehistory">mergehistory</a>
Merge page histories.
<a href="/api.php?action=help&modules=move">move</a>
Move a page.
<a href="/api.php?action=help&modules=opensearch">opensearch</a>
Search the wiki using the OpenSearch protocol.
<a href="/api.php?action=help&modules=options">options</a>
Change preferences of the current user.
<a href="/api.php?action=help&modules=paraminfo">paraminfo</a>
Obtain information about API modules.
<a href="/api.php?action=help&modules=parse">parse</a>
Parses content and returns parser output.
<a href="/api.php?action=help&modules=patrol">patrol</a>
Patrol a page or revision.
<a href="/api.php?action=help&modules=protect">protect</a>
Change the protection level of a page.
<a href="/api.php?action=help&modules=purge">purge</a>
Purge the cache for the given titles.
<a href="/api.php?action=help&modules=query">query</a>
Fetch data from and about MediaWiki.
<a href="/api.php?action=help&modules=removeauthenticationdata">removeauthenticationdata</a>
Remove authentication data for the current user.
<a href="/api.php?action=help&modules=resetpassword">resetpassword</a>
Send a password reset email to a user.
<a href="/api.php?action=help&modules=revisiondelete">revisiondelete</a>
Delete and undelete revisions.
<a href="/api.php?action=help&modules=rollback">rollback</a>
Undo the last edit to the page.
<a href="/api.php?action=help&modules=rsd">rsd</a>
Export an RSD (Really Simple Discovery) schema.
<a href="/api.php?action=help&modules=setnotificationtimestamp">setnotificationtimestamp</a>
Update the notification timestamp for watched pages.
<a href="/api.php?action=help&modules=setpagelanguage">setpagelanguage</a>
Change the language of a page.
<a href="/api.php?action=help&modules=tag">tag</a>
Add or remove change tags from individual revisions or log entries.
<a href="/api.php?action=help&modules=templatedata">templatedata</a>
Fetch data stored by the TemplateData extension.
<a href="/api.php?action=help&modules=unblock">unblock</a>
Unblock a user.
<a href="/api.php?action=help&modules=undelete">undelete</a>
Restore revisions of a deleted page.
<a href="/api.php?action=help&modules=unlinkaccount">unlinkaccount</a>
Remove a linked third-party account from the current user.
<a href="/api.php?action=help&modules=upload">upload</a>
Upload a file, or get the status of pending uploads.
<a href="/api.php?action=help&modules=userrights">userrights</a>
Change a user's group membership.
<a href="/api.php?action=help&modules=validatepassword">validatepassword</a>
Validate a password against the wiki's password policies.
<a href="/api.php?action=help&modules=watch">watch</a>
Add or remove pages from the current user's watchlist.
<a href="/api.php?action=help&modules=tokens">tokens</a>
Deprecated. Get tokens for data-modifying actions.
<a href="/api.php?action=help&modules=cspreport">cspreport</a>
Internal. Used by browsers to report violations of the Content Security Policy. This module should never be used, except when used automatically by a CSP compliant web browser.
<a href="/api.php?action=help&modules=scribunto-console">scribunto-console</a>
Internal. Internal module for servicing XHR requests from the Scribunto console.
<a href="/api.php?action=help&modules=stashedit">stashedit</a>
Internal. Prepare an edit in shared cache.
<a href="/api.php?action=help&modules=visualeditor">visualeditor</a>
Internal. Returns HTML5 for a page from the Parsoid service.
<a href="/api.php?action=help&modules=visualeditoredit">visualeditoredit</a>
Internal. Save an HTML5 page to MediaWiki (converted to wikitext via the Parsoid service).
One of the following values: <a href="/api.php?action=help&modules=block">block</a>, <a href="/api.php?action=help&modules=changeauthenticationdata">changeauthenticationdata</a>, <a href="/api.php?action=help&modules=changecontentmodel">changecontentmodel</a>, <a href="/api.php?action=help&modules=checktoken">checktoken</a>, <a href="/api.php?action=help&modules=clearhasmsg">clearhasmsg</a>, <a href="/api.php?action=help&modules=clientlogin">clientlogin</a>, <a href="/api.php?action=help&modules=compare">compare</a>, <a href="/api.php?action=help&modules=createaccount">createaccount</a>, <a href="/api.php?action=help&modules=delete">delete</a>, <a href="/api.php?action=help&modules=edit">edit</a>, <a href="/api.php?action=help&modules=emailuser">emailuser</a>, <a href="/api.php?action=help&modules=expandtemplates">expandtemplates</a>, <a href="/api.php?action=help&modules=feedcontributions">feedcontributions</a>, <a href="/api.php?action=help&modules=feedrecentchanges">feedrecentchanges</a>, <a href="/api.php?action=help&modules=feedwatchlist">feedwatchlist</a>, <a href="/api.php?action=help&modules=filerevert">filerevert</a>, <a href="/api.php?action=help&modules=help">help</a>, <a href="/api.php?action=help&modules=imagerotate">imagerotate</a>, <a href="/api.php?action=help&modules=import">import</a>, <a href="/api.php?action=help&modules=linkaccount">linkaccount</a>, <a href="/api.php?action=help&modules=login">login</a>, <a href="/api.php?action=help&modules=logout">logout</a>, <a href="/api.php?action=help&modules=managetags">managetags</a>, <a href="/api.php?action=help&modules=mergehistory">mergehistory</a>, <a href="/api.php?action=help&modules=move">move</a>, <a href="/api.php?action=help&modules=opensearch">opensearch</a>, <a href="/api.php?action=help&modules=options">options</a>, <a href="/api.php?action=help&modules=paraminfo">paraminfo</a>, <a href="/api.php?action=help&modules=parse">parse</a>, <a href="/api.php?action=help&modules=patrol">patrol</a>, <a href="/api.php?action=help&modules=protect">protect</a>, <a href="/api.php?action=help&modules=purge">purge</a>, <a href="/api.php?action=help&modules=query">query</a>, <a href="/api.php?action=help&modules=removeauthenticationdata">removeauthenticationdata</a>, <a href="/api.php?action=help&modules=resetpassword">resetpassword</a>, <a href="/api.php?action=help&modules=revisiondelete">revisiondelete</a>, <a href="/api.php?action=help&modules=rollback">rollback</a>, <a href="/api.php?action=help&modules=rsd">rsd</a>, <a href="/api.php?action=help&modules=setnotificationtimestamp">setnotificationtimestamp</a>, <a href="/api.php?action=help&modules=setpagelanguage">setpagelanguage</a>, <a href="/api.php?action=help&modules=tag">tag</a>, <a href="/api.php?action=help&modules=templatedata">templatedata</a>, <a href="/api.php?action=help&modules=unblock">unblock</a>, <a href="/api.php?action=help&modules=undelete">undelete</a>, <a href="/api.php?action=help&modules=unlinkaccount">unlinkaccount</a>, <a href="/api.php?action=help&modules=upload">upload</a>, <a href="/api.php?action=help&modules=userrights">userrights</a>, <a href="/api.php?action=help&modules=validatepassword">validatepassword</a>, <a href="/api.php?action=help&modules=watch">watch</a>, <a href="/api.php?action=help&modules=tokens">tokens</a>, <a href="/api.php?action=help&modules=cspreport">cspreport</a>, <a href="/api.php?action=help&modules=scribunto-console">scribunto-console</a>, <a href="/api.php?action=help&modules=stashedit">stashedit</a>, <a href="/api.php?action=help&modules=visualeditor">visualeditor</a>, <a href="/api.php?action=help&modules=visualeditoredit">visualeditoredit</a>
Default: help
format

The format of the output.

<a href="/api.php?action=help&modules=json">json</a>
Output data in JSON format.
<a href="/api.php?action=help&modules=jsonfm">jsonfm</a>
Output data in JSON format (pretty-print in HTML).
<a href="/api.php?action=help&modules=none">none</a>
Output nothing.
<a href="/api.php?action=help&modules=php">php</a>
Output data in serialized PHP format.
<a href="/api.php?action=help&modules=phpfm">phpfm</a>
Output data in serialized PHP format (pretty-print in HTML).
<a href="/api.php?action=help&modules=rawfm">rawfm</a>
Output data, including debugging elements, in JSON format (pretty-print in HTML).
<a href="/api.php?action=help&modules=xml">xml</a>
Output data in XML format.
<a href="/api.php?action=help&modules=xmlfm">xmlfm</a>
Output data in XML format (pretty-print in HTML).
One of the following values: <a href="/api.php?action=help&modules=json">json</a>, <a href="/api.php?action=help&modules=jsonfm">jsonfm</a>, <a href="/api.php?action=help&modules=none">none</a>, <a href="/api.php?action=help&modules=php">php</a>, <a href="/api.php?action=help&modules=phpfm">phpfm</a>, <a href="/api.php?action=help&modules=rawfm">rawfm</a>, <a href="/api.php?action=help&modules=xml">xml</a>, <a href="/api.php?action=help&modules=xmlfm">xmlfm</a>
Default: jsonfm
maxlag

Maximum lag can be used when MediaWiki is installed on a database replicated cluster. To save actions causing any more site replication lag, this parameter can make the client wait until the replication lag is less than the specified value. In case of excessive lag, error code maxlag is returned with a message like Waiting for $host: $lag seconds lagged.
See <a href="http://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Maxlag_parameter" class="extiw" title="mw:Special:MyLanguage/Manual:Maxlag parameter">Manual: Maxlag parameter</a> for more information.

Type: integer
smaxage

Set the s-maxage HTTP cache control header to this many seconds. Errors are never cached.

Type: integer
Default: 0
maxage

Set the max-age HTTP cache control header to this many seconds. Errors are never cached.

Type: integer
Default: 0
assert

Verify that the user is logged in if set to user, not logged in if set to anon, or has the bot user right if bot.

One of the following values: anon, bot, user
assertuser

Verify the current user is the named user.

Type: user, by user name
requestid

Any value given here will be included in the response. May be used to distinguish requests.

servedby

Include the hostname that served the request in the results.

Type: boolean (<a href="#main.2Fdatatype.2Fboolean">details</a>)
curtimestamp

Include the current timestamp in the result.

Type: boolean (<a href="#main.2Fdatatype.2Fboolean">details</a>)
responselanginfo

Include the languages used for uselang and errorlang in the result.

Type: boolean (<a href="#main.2Fdatatype.2Fboolean">details</a>)
origin

When accessing the API using a cross-domain AJAX request (CORS), set this to the originating domain. This must be included in any pre-flight request, and therefore must be part of the request URI (not the POST body).

For authenticated requests, this must match one of the origins in the Origin header exactly, so it has to be set to something like <a rel="nofollow" class="external free" href="https://en.wikipedia.org">https://en.wikipedia.org</a> or <a rel="nofollow" class="external free" href="https://meta.wikimedia.org">https://meta.wikimedia.org</a>. If this parameter does not match the Origin header, a 403 response will be returned. If this parameter matches the Origin header and the origin is whitelisted, the Access-Control-Allow-Origin and Access-Control-Allow-Credentials headers will be set.

For non-authenticated requests, specify the value *. This will cause the Access-Control-Allow-Origin header to be set, but Access-Control-Allow-Credentials will be false and all user-specific data will be restricted.

uselang

Language to use for message translations. <a href="/api.php?action=help&modules=query%2Bsiteinfo">action=query&meta=siteinfo</a> with siprop=languages returns a list of language codes, or specify user to use the current user's language preference, or specify content to use this wiki's content language.

Default: user
errorformat

Format to use for warning and error text output.

plaintext
Wikitext with HTML tags removed and entities replaced.
wikitext
Unparsed wikitext.
html
HTML.
raw
Message key and parameters.
none
No text output, only the error codes.
bc
Format used prior to MediaWiki 1.29. errorlang and errorsuselocal are ignored.
One of the following values: bc, html, none, plaintext, raw, wikitext
Default: bc
errorlang

Language to use for warnings and errors. <a href="/api.php?action=help&modules=query%2Bsiteinfo">action=query&meta=siteinfo</a> with siprop=languages returns a list of language codes, or specify content to use this wiki's content language, or specify uselang to use the same value as the uselang parameter.

Default: uselang
errorsuselocal

If given, error texts will use locally-customized messages from the MediaWiki namespace.

Type: boolean (<a href="#main.2Fdatatype.2Fboolean">details</a>)
Examples:
Help for the main module.
<a href="/api.php?action=help" dir="ltr">api.php?action=help</a> <a href="/index.php/Special:ApiSandbox#action=help">[open in sandbox]</a>
All help in one page.
<a href="/api.php?action=help&recursivesubmodules=1" dir="ltr">api.php?action=help&recursivesubmodules=1</a> <a href="/index.php/Special:ApiSandbox#action=help&recursivesubmodules=1">[open in sandbox]</a>
Permissions:
writeapi
Use of the write API
Granted to: all, user and bot
apihighlimits
Use higher limits in API queries (slow queries: 500; fast queries: 5000). The limits for slow queries also apply to multivalue parameters.
Granted to: bot and sysop

Data types

Input to MediaWiki should be NFC-normalized UTF-8. MediaWiki may attempt to convert other input, but this may cause some operations (such as <a href="/api.php?action=help&modules=edit">edits</a> with MD5 checks) to fail.

Parameters that take multiple values are normally submitted with the values separated using the pipe character, e.g. param=value1|value2 or param=value1%7Cvalue2. If a value must contain the pipe character, use U+001F (Unit Separator) as the separator and prefix the value with U+001F, e.g. param=%1Fvalue1%1Fvalue2.

Some parameter types in API requests need further explanation:

boolean

Boolean parameters work like HTML checkboxes: if the parameter is specified, regardless of value, it is considered true. For a false value, omit the parameter entirely.

expiry

Expiry values be relative (e.g. 5 months or 2 weeks) or absolute (e.g. 2014-09-18T12:34:56Z). For no expiry, use infinite, indefinite, infinity or never.

timestamp

Timestamps may be specified in several formats, see <a href="http://www.mediawiki.org/wiki/Special:MyLanguage/Timestamp" class="extiw" title="mw:Special:MyLanguage/Timestamp">the Timestamp library input formats documented on mediawiki.org</a> for details. ISO 8601 date and time is recommended: 2001-01-15T14:56:00Z. Additionally, the string now may be used to specify the current timestamp.

Templated parameters

Templated parameters support cases where an API module needs a value for each value of some other parameter. For example, if there were an API module to request fruit, it might have a parameter fruits to specify which fruits are being requested and a templated parameter {fruit}-quantity to specify how many of each fruit to request. An API client that wants 1 apple, 5 bananas, and 20 strawberries could then make a request like fruits=apples|bananas|strawberries&apples-quantity=1&bananas-quantity=5&strawberries-quantity=20.

Credits

API developers:

  • Yuri Astrakhan (creator, lead developer Sep 2006–Sep 2007)
  • Roan Kattouw (lead developer Sep 2007–2009)
  • Victor Vasiliev
  • Bryan Tong Minh
  • Sam Reed
  • Brad Jorsch (lead developer 2013–present)

Please send your comments, suggestions and questions to mediawiki-api@lists.wikimedia.org

or file a bug report at <a rel="nofollow" class="external free" href="https://phabricator.wikimedia.org/">https://phabricator.wikimedia.org/</a>.

<script>(RLQ=window.RLQ||[]).push(function(){mw.config.set({"wgBackendResponseTime":989});});</script>

</body></html>