User:Pavithraes/Sandbox/API:FAQ

Overview
This page provides answers to some frequently asked questions about the MediaWiki Action API.

Also read the API:Main page as it answers some questions not answered here and points to other useful pages.

What is the MediaWiki Action API?
The MediaWiki Action API is a RESTful  web service that allows users to perform certain wiki-actions like page creation, authentication, parsing, searching, etc.

What can the MediaWiki Action API be used for?
The MediaWiki Action API can be used to:
 * access wiki features.
 * interact with a wiki.
 * obtain meta-information about wikis and public users.

The right sidebar points to many features supported by the API. Also see some Wikimedia projects that use the MediaWiki Action API.

How can I use (or call) the MediaWiki Action API?
Commonly, HTTP requests and responses are used to call the Action API. For detailed instructions, see API:Tutorial.

To play with the Action API: The API can also be called internally for testing purposes.
 * Use the Special:ApiSandbox.
 * Enable your browser's developer console and watch net requests to  as you interact with the wiki.

What is a module, a submodule and a parameter?
The MediaWiki Action API has numerous modules that we use to perform different tasks. In technical terms, a module is a subclass of ApiBase. A module requires parameters. These parameters may (or may not) in-turn be submodules.

Consider the following request,


 * is a parameter of the main module.
 * is another module. It is called the  module.
 * is a parameter of the  module.
 * is also a module. It can be called a submodule of.
 * is a parameter of the  module. It holds the search string.
 * is a parameter of the main module.

How do I know which module and submodule to call?
The MediaWiki Action API is big, and extensions further enlarge it. Here are a few ways to work out your API request.
 * The sidebar on the right points to certain features, refer to the corresponding pages for information about the modules and submodules.
 * The auto-generated documentation contains a list of all modules and submodules with brief descriptions. You can start at the main module and follow the links to different submodules. To view the expanded version, append
 * The API documentation contains detailed descriptions about all modules and submodules. API:Main_module can be your starting point.
 * If you need extra help, see Help.

Can I control the output format?
Yes, to control the output format, you can pass  in the query string. JSON and XML the commonly used output formats.

For information on data formats see: API:Data_formats.

Where can I find examples?
The API documentation pages contain an 'Examples' section to demonstrate how different modules and submodules can be used. The [https://www.mediawiki.org/w/api.php? auto-generated docs] also have a few examples trailing the module descriptions.

Do I need an access token?
You will require an access token to perform data modifying actions. For example, logging in, editing and moving pages.

To learn more, refer to API:Tokens or the sidebar category 'Authentication'.

What are wiki dumps and how can I work with them?
Wikimedia’s data dumps are dumps of wiki collections, content, metadata, search indices, etc. To work with dumps, see using dumps and public dumps.

What are,  and other terms in query results?
Every wiki page has a  which remains unchanged when a page is moved or renamed and   refers to the primary key of each revision.

For details regarding such terms refer to Manual:revision table, Manual:page table and other corresponding tables in the 'Manual' namespace.

Is there a limit to query results?
Yes, it depends on the query. For example, the results for list and property queries cannot exceed 500 for regular users. The API pages contain information about these limits in the 'Additional notes' section or the 'Limits' section.

Is there a limit to API calls?
There is no concrete limit, though we recommend making a reasonable number of calls to prevent getting blocked. If you want to make many requests, contact the administrators beforehand. See API:Etiquette for more information.

Where can I get updates about the MediaWiki Action API?
Subscribe to the MediaWiki-API-Announce mailing list for announcements and updates.

Are there other Wikimedia APIs?
Yes. See Web APIs hub and REST API.

Where can I get more help?
If you can't find answers in the MediaWiki API documentation or the auto-generated documentation pages, feel free to reach out in the following ways.
 * Create a Wikimedia account (if you don't have one already) and add a new topic on the API discussion page.
 * Ask your question on:
 * IRC in the channel on the Freenode network.
 * MediaWiki-API mailing list.

How to make cross-site requests using the API?
API:Cross-site_requests

How to create an API module in an extension?
API:Extensions

How is the MediaWiki Action API machinery implemented in core?
API:Implementation_Strategy

How to restrict API usage?
API:Restricting_API_usage

How to allow/restrict modifying wiki content using the API?
API:Changing_wiki_content

How do I detect an error?
An error response from the API will set the  HTTP header and return an error structure.

What does this error mean?
Refer to the list of standard error messages: API:Errors_and_warnings

Am I facing errors due to version change?
If a website runs a different version of MediaWiki, it would also run a diffrent version of the API. Some module parameters supported in one version might be deprecated or removed in others. The documentation pages mention any such deprecations. For example,  is deprecated in API:Random.

How do I file a bug/feature requests?
Bug and feature request can be reported on Phabricator with the MediaWiki-API project tag. If the functionality you are requesting or reporting a bug against is offered by an extension (e.g. AbuseFilter, FlaggedRevs), add that extension's project, e.g. "MediaWiki-extensions-AbuseFilter". Note to verify for duplicate tasks and understand the task creation terms on Phabricator before proceeding. See How_to_report_a_bug for more details.

What is an API?
An API is an acronym for Application Programming Interface. It allows different applications to communicate with each other. In general terms, it refers to web-based APIs which use HTTP requests-resonse mechanism and produce JSON/XML structured data.

What is a REST API?
REST is an acronym for REpresentational State Transfer. A set of guiding principles or constraints define a RESTful system. A RESTful API or just, a REST API adheres to these principles and hence is a faster, more reliable and a scalable service.

What can an API do?
See some uses of API.

Where can I learn more about APIs?

 * Understanding APIs
 * An Introduction to API’s
 * What is REST — A Simple Explanation for Beginners, Part 1: Introduction